Skip to content

Commit 025178a

Browse files
committed
Additional testing functionality. It's now possible to add 'sort' to the result codes in testurl.list, and the lines of the pages returned will be sorted before they are compared.
- Legacy-Id: 397
1 parent de55978 commit 025178a

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

ietf/tests.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ def testCoverage(self):
139139
#self.assertEqual(set(patterns), set(covered), "Not all the
140140
#application URLs has test cases. The missing are: %s" % (list(set(patterns) - set(covered))))
141141
if not set(self.patterns) == set(covered):
142-
#print "Not all the application URLs has test cases. The missing are: \n %s" % ("\n ".join(list(set(patterns) - set(covered))))
143-
print "Not all the application URLs has test cases."
142+
print "Not all the application URLs has test cases. The missing are: \n %s" % ("\n ".join(list(set(patterns) - set(covered))))
143+
else:
144+
print "All the application URL patterns seem to have test cases."
145+
#print "Not all the application URLs has test cases."
144146

145147
def doUrlsTest(self, lst):
146148
response_count = {}
@@ -175,6 +177,16 @@ def doUrlsTest(self, lst):
175177
if goodhtml and response.content:
176178
testtext = reduce(response.content)
177179
goodtext = reduce(goodhtml)
180+
if "sort" in codes:
181+
try:
182+
def sorted(l):
183+
l.sort()
184+
return l
185+
testtext = sorted(testtext)
186+
goodtext = sorted(goodtext)
187+
except:
188+
print "Exception occurred when trying to do sorted comparison"
189+
traceback.print_exc()
178190
if testtext == goodtext:
179191
print "OK cmp %s" % (url)
180192
else:
@@ -211,7 +223,8 @@ def doUrlsTest(self, lst):
211223

212224
except:
213225
print "Exception occurred for url %s" % (url)
214-
raise
226+
traceback.print_exc()
227+
#raise
215228

216229
if not res in response_count:
217230
response_count[res] = 0
@@ -241,7 +254,8 @@ def testUrlsFallback(self):
241254
if re.search("^[-a-z0-9./_]*$", url) and not url in self.testurls and not url.startswith("/admin/"):
242255
lst.append((["200"], url, None))
243256
else:
244-
print "Test exists for %s" % (url)
257+
#print "No fallback test for %s" % (url)
258+
pass
245259
else:
246260
lst.append((["Skip"], pattern, None))
247261

0 commit comments

Comments
 (0)