def test_parsing_id_exception(self): """ One of the animes breaks the parsing system due to wthere it has an odd or even number depends whether it gets a class or not on anidb """ anime = Bunch(aid="a123") responses.add(responses.GET, url='http://anidb.net/perl-bin/animedb.pl?show=anime&aid='+str(anime.aid)+"&showallag=1#grouplist", body=Data.broken_html,match_querystring=True,status=200) anidb = AniDB() sub_groups = anidb.get_sub_groups(anime) self.assertEqual(len(sub_groups),30)
def test_get_sub_groups_2(self): """ Test that the dict contains the correct data """ anime = Bunch(aid="a123") responses.add(responses.GET, url='http://anidb.net/perl-bin/animedb.pl?show=anime&aid='+str(anime.aid)+"&showallag=1#grouplist", body=Data.anime_page,match_querystring=True,status=200) anidb = AniDB() sub_groups = anidb.get_sub_groups(anime) group = sub_groups[0] print sub_groups print group self.assertEqual("AdiEnt",group["name"]) self.assertEqual("12871",group["gid"])
def test_get_sub_groups(self): """ Test returns correct number of groups """ anime = Bunch(aid="a123") # xml = "" responses.add(responses.GET, url='http://anidb.net/perl-bin/animedb.pl?show=anime&aid='+str(anime.aid)+"&showallag=1#grouplist", body=Data.anime_page,match_querystring=True,status=200) number = 27 anidb = AniDB() self.assertEqual(anime.aid, "a123") sub_groups = anidb.get_sub_groups(anime) self.assertEqual(number,len(sub_groups))
def test_parsing_bleach(self): anime = Bunch(aid="a123") responses.add(responses.GET, url='http://anidb.net/perl-bin/animedb.pl?show=anime&aid='+str(anime.aid)+"&showallag=1#grouplist", body=Data.bleach_page,match_querystring=True,status=200) anidb = AniDB() sub_groups = anidb.get_sub_groups(anime) group = sub_groups[0] print sub_groups print group self.assertEqual(len(sub_groups),233) self.assertEqual("Hi10",group["name"]) self.assertEqual("11111",group["gid"]) # should throw no exceptions for raw in sub_groups: grp = Sub_Group(dictionary = raw)