Test stripUrl.

This commit is contained in:
Bastian Kleineidam 2012-11-14 06:21:59 +01:00
parent eba2f0089d
commit 60b5ed88f3

View file

@ -28,11 +28,14 @@ class _ComicTester(TestCase):
for image in strip.getImages(): for image in strip.getImages():
images += 1 images += 1
self.save(image) self.save(image)
if images: if num > 0:
# test that the stripUrl regex matches the retrieved strip URL # test that the stripUrl regex matches the retrieved strip URL
urlmatch = re.escape(self.scraperclass.stripUrl).replace("%s", r".+") urlmatch = re.escape(self.scraperclass.stripUrl)
mo = re.compile(urlmatch).match(strip.stripUrl) urlmatch = urlmatch.replace(r"\%s", r".+")
self.check(mo is not None, 'strip URL %r does not match %r' % (strip.stripUrl, self.scraperclass.stripUrl)) urlmatch = "^%s$" % urlmatch
ro = re.compile(urlmatch)
mo = ro.search(strip.stripUrl)
self.check(mo is not None, 'strip URL %r does not match %s' % (strip.stripUrl, urlmatch))
else: else:
empty += 1 empty += 1
num += 1 num += 1