Correct channel is now -syscom
[public/csc-status.git] / tests.d / 50_website.py
1 #!/usr/bin/env python
2 import urllib2, sys
3
4 pages=["https://csclub.uwaterloo.ca",
5        "http://mirror.csclub.uwaterloo.ca",
6        "http://git.csclub.uwaterloo.ca"]
7
8 for theurl in pages:
9   try:
10     r = urllib2.urlopen(theurl, timeout=3)
11     page = r.read()
12     if not len(page) > 1000:
13       print "FAIL, didn't have enough data"
14       sys.exit(2)
15     if not ("Computer Science Club" in page or "git.csclub.uwaterloo.ca Git" in page):
16       print "FAIL,", theurl, "doesn't mention Computer Science Club"
17       sys.exit(3)
18   except urllib2.URLError as e:
19     print "FAIL, exception ", e
20     sys.exit(1)
21
22 # So read() didn't throw an exception, nor did opening,
23 # and we have enough data, so likely good.
24 sys.exit(0)