From 49f8de31b464e3ea260fd8c85c3132f8f9a44772 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Tue, 5 Jun 2007 18:43:48 +0000 Subject: [PATCH] Permitting both 404 and 200 responses for some URLs, for now; till we can run tests with a populated database - Legacy-Id: 242 --- ietf/tests.py | 19 +++++++++++-------- ietf/testurl.list | 13 +++++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ietf/tests.py b/ietf/tests.py index 5f6ce6871..dabd6d5e4 100644 --- a/ietf/tests.py +++ b/ietf/tests.py @@ -50,13 +50,14 @@ class UrlTestCase(TestCase): if line and not line.startswith('#'): urlspec = line.split() if len(urlspec) == 2: - code, testurl = urlspec + codes, testurl = urlspec goodurl = None elif len(urlspec) == 3: - code, testurl, goodurl = urlspec + codes, testurl, goodurl = urlspec else: raise ValueError("Expected 'HTTP_CODE TESTURL [GOODURL]' in %s line, found '%s'." % (filename, line)) - self.testtuples += [ (code, testurl, goodurl) ] + codes = codes.split(",") + self.testtuples += [ (codes, testurl, goodurl) ] self.testurls += [ testurl ] #print "(%s, %s, %s)" % (code, testurl, goodurl) #print self.testtuples @@ -64,7 +65,7 @@ class UrlTestCase(TestCase): def testCoverage(self): covered = [] patterns = get_patterns(ietf.urls) - for code, testurl, goodurl in self.testtuples: + for codes, testurl, goodurl in self.testtuples: for pattern in patterns: if re.match(pattern, testurl[1:]): covered.append(pattern) @@ -77,14 +78,16 @@ class UrlTestCase(TestCase): print "Not all the application URLs has test cases." def testUrls(self): - for code, testurl, goodurl in self.testtuples: - if code in ["skip", "Skip"]: + for codes, testurl, goodurl in self.testtuples: + if codes[0] in ["skip", "Skip"]: print "Skipping %s" % (testurl) else: try: response = self.client.get(testurl) - print "Got code %s for %s" % (response.status_code, testurl) - #self.assertEqual(response.status_code, code, "Unexpected response code (%s) for URL '%s'" % (response.status_code, testurl)) + code = response.status_code + print "Got code %s for %s" % (code, testurl) + if not code in codes: + self.fail("Unexpected response code (%s) for URL '%s'" % (code, testurl)) # TODO: Add comparison with goodurl except: print "Exception for URL '%s'" % testurl diff --git a/ietf/testurl.list b/ietf/testurl.list index 8dc491c6c..04cf51b2b 100644 --- a/ietf/testurl.list +++ b/ietf/testurl.list @@ -1,7 +1,9 @@ # Broken URLs have been commented out 200 / -#200 /accounts/ +200 /accounts/ +200,404 /accounts/password_change/ +200,404 /accounts/profile/ #200 /admin #200 /announcements/ 200 /idindex/ @@ -20,6 +22,8 @@ 200 /idindex/inddocs/B/ 200 /idindex/inddocs/Y/ 200 /idindex/otherdocs/iab/ +200,404 /idtracker/status/ +200,404 /idtracker/last_call/ 200 /iesg/telechat/ 200 /iesg/telechat/2006/ 200 /iesg/telechat/2006/feb/ @@ -36,10 +40,11 @@ 200 /ipr/new-specific/ 200 /ipr/new-third-party/ skip /my/ -#200 /liaisons/ +200,404 /liaisons/ +200,404 /liaisons/managers/ #200 /liaisons/329/ -#200 /mailing-lists/area-lists/ -#200 /mailing-lists/nonwg-lists/ +200,404 /mailing-lists/area-lists/ +200,404 /mailing-lists/nonwg-lists/ #200 /mailing-lists/nonwg-lists/submit/ #200 /mailing-lists/request/ #200 /mailing-lists/area-lists/