Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Nandaka committed Oct 25, 2015
1 parent 1ea653d commit 98b3f58
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
36 changes: 15 additions & 21 deletions test.PixivModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def testPixivImageParseBig(self):
urls = image.ParseImages(page, mode='big')
self.assertEqual(len(urls), 1)
print urls[0]
imageId = urls[0].split('/')[-1].split('.')[0]
imageId = urls[0].split('/')[-1].split('_')[0]
#print 'imageId:',imageId
self.assertEqual(int(imageId), 2493913)

Expand Down Expand Up @@ -411,7 +411,7 @@ def testPixivImageBookmark(self):
page = BeautifulSoup(p.read())
result = PixivBookmark.parseImageBookmark(page)

self.assertEqual(len(result), 19)
self.assertEqual(len(result), 20)
self.assertTrue(35303260 in result)
self.assertTrue(28629066 in result)
self.assertTrue(27249307 in result)
Expand Down Expand Up @@ -476,7 +476,7 @@ def testTagsSearchExact1(self):
image = PixivTags()
image.parseTags(page)

self.assertEqual(len(image.itemList), 20)
self.assertEqual(len(image.itemList), 19)
self.assertEqual(image.isLastPage, False)

## tags.php?tag=%E3%81%93%E3%81%AE%E4%B8%AD%E3%81%AB1%E4%BA%BA%E3%80%81%E5%A6%B9%E3%81%8C%E3%81%84%E3%82%8B%21
Expand Down Expand Up @@ -585,22 +585,16 @@ def testParseJson(self):
self.assertEqual(result.maxId, 626288)

if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestPixivArtist)
unittest.TextTestRunner(verbosity=5).run(suite)
print "================================================================"
suite = unittest.TestLoader().loadTestsFromTestCase(TestPixivImage)
unittest.TextTestRunner(verbosity=5).run(suite)
print "================================================================"
suite = unittest.TestLoader().loadTestsFromTestCase(TestPixivBookmark)
unittest.TextTestRunner(verbosity=5).run(suite)
print "================================================================"
suite = unittest.TestLoader().loadTestsFromTestCase(TestMyPickPage)
unittest.TextTestRunner(verbosity=5).run(suite)
print "================================================================"
suite = unittest.TestLoader().loadTestsFromTestCase(TestPixivTags)
unittest.TextTestRunner(verbosity=5).run(suite)
print "================================================================"
suite = unittest.TestLoader().loadTestsFromTestCase(TestPixivGroup)
unittest.TextTestRunner(verbosity=5).run(suite)
raw_input("anykey")
test_classes_to_run = [TestPixivArtist, TestPixivImage, TestPixivBookmark, TestMyPickPage, TestPixivTags, TestPixivGroup]

loader = unittest.TestLoader()

suites_list = []
for test_class in test_classes_to_run:
suite = loader.loadTestsFromTestCase(test_class)
suites_list.append(suite)

big_suite = unittest.TestSuite(suites_list)

runner = unittest.TextTestRunner(verbosity=5)
results = runner.run(big_suite)
2 changes: 1 addition & 1 deletion test.updateHtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def main():

downloadPage('http://www.pixiv.net/bookmark.php', './test/test-image-bookmark.htm')

downloadPage('http://www.pixiv.net/member_illust.php?id=313631&p=5', './test/test-tags-member-search-last.htm')
downloadPage('http://www.pixiv.net/member_illust.php?id=313631&p=6', './test/test-tags-member-search-last.htm')
downloadPage('http://www.pixiv.net/search.php?word=%E5%88%9D%E6%98%A5%E9%A3%BE%E5%88%A9&s_mode=s_tag_full', './test/test-tags-search-exact.htm')
downloadPage('http://www.pixiv.net/search.php?word=%E3%81%93%E3%81%AE%E4%B8%AD%E3%81%AB1%E4%BA%BA%E3%80%81%E5%A6%B9%E3%81%8C%E3%81%84%E3%82%8B!&s_mode=s_tag_full&order=date_d&p=12', './test/test-tags-search-partial.htm')
downloadPage('http://www.pixiv.net/search.php?s_mode=s_tag_full&word=XXXXXX','./test/test-tags-search-exact-parse_details.htm')
Expand Down
Loading

0 comments on commit 98b3f58

Please sign in to comment.