def testParseMemberBookmarksByTags(self): p = open('./test/bookmarks-1039353.json', 'r') member = PixivArtist(1039353, p.read(), False, 0, 24) self.assertIsNotNone(member) p2 = open('./test/userdetail-1039353.json', 'r') info = json.loads(p2.read()) member.ParseInfo(info, False, True) member.PrintInfo() self.assertEqual(member.artistId, 1039353) self.assertTrue(member.haveImages) self.assertFalse(member.isLastPage)
def testParseMemberImagesByTagsLastPage(self): p = open('./test/tag-R-18-14095911-lastpage.json', 'r') member = PixivArtist(14095911, p.read(), False, 48, 24) self.assertIsNotNone(member) p2 = open('./test/userdetail-14095911.json', 'r') info = json.loads(p2.read()) member.ParseInfo(info, False, False) member.PrintInfo() self.assertEqual(member.artistId, 14095911) self.assertTrue(member.haveImages) self.assertTrue(member.isLastPage)
def testParseMemberImagesLastPage(self): p = open('./test/all-14095911.json', 'r') member = PixivArtist(14095911, p.read(), False, 96, 48) self.assertIsNotNone(member) p2 = open('./test/userdetail-14095911.json', 'r') info = json.loads(p2.read()) member.ParseInfo(info, False, False) member.PrintInfo() self.assertEqual(member.artistId, 14095911) self.assertEqual(member.totalImages, 143) self.assertTrue(member.haveImages) self.assertTrue(member.isLastPage)
def testParseMemberImages2(self): p = open('./test/all-26357.json', 'r') member = PixivArtist(26357, p.read(), False, 0, 24) self.assertIsNotNone(member) p2 = open('./test/userdetail-26357.json', 'r') info = json.loads(p2.read()) member.ParseInfo(info, False, False) member.PrintInfo() self.assertEqual(member.artistId, 26357) self.assertTrue(member.haveImages) self.assertFalse(member.isLastPage) self.assertEqual(member.artistToken, 'yukimaruko') self.assertGreater(member.totalImages, 7) self.assertEqual(member.artistAvatar, "https://s.pximg.net/common/images/no_profile.png")
def testParseMemberError(self): p = open('./test/ajax-error.json', 'r') try: member = PixivArtist(14095911, p.read()) self.fail("Exception expected.") except Exception as ex: self.assertTrue(ex.errorCode == PixivException.OTHER_MEMBER_ERROR)
def testParseMemberImages(self): p = open('./test/all-14095911.json', 'r') member = PixivArtist(14095911, p.read(), False, 0, 24) self.assertIsNotNone(member) p2 = open('./test/userdetail-14095911.json', 'r') info = json.loads(p2.read()) member.ParseInfo(info, False, False) member.PrintInfo() self.assertEqual(member.artistId, 14095911) self.assertTrue(member.haveImages) self.assertFalse(member.isLastPage) self.assertEqual(member.artistToken, 'p199451') self.assertGreater(member.totalImages, 70) self.assertEqual( member.artistAvatar, "https://i.pximg.net/user-profile/img/2018/02/01/23/55/46/13768317_dc1474fef3dc982ade71c1b2dbf32d9e.png" )