Skip to content

Commit

Permalink
add bangumi book test
Browse files Browse the repository at this point in the history
  • Loading branch information
j1g5awi authored Dec 9, 2024
1 parent fb876fb commit 20ce991
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions catalog/book/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,26 @@ def test_scrape(self):
self.assertEqual(site.resource.item.author[0], "爱潜水的乌贼")


class BangumiTestCase(TestCase):
databases = "__all__"

@use_local_response
def test_scrape(self):
t_url = "https://bgm.tv/subject/342254"
site = SiteManager.get_site_by_url(t_url)
self.assertEqual(site.ready, False)
site.get_resource_ready()
self.assertEqual(site.ready, True)
self.assertEqual(site.resource.site_name, SiteName.Bangumi)
self.assertEqual(site.resource.id_type, IdType.Bangumi)
self.assertEqual(site.resource.id_value, "342254")
self.assertEqual(site.resource.item.localized_title[0]["text"], "蓦然回首")
self.assertEqual(site.resource.item.author[0], "藤本タツキ")
self.assertEqual(site.resource.item.isbn, "9784088827827")
self.assertEqual(site.resource.item.pages, "144")
self.assertEqual(site.resource.item.price, "¥484")


class MultiBookSitesTestCase(TestCase):
databases = "__all__"

Expand Down

0 comments on commit 20ce991

Please sign in to comment.