Fix tests

This commit is contained in:
Yohann D'ANELLO 2021-10-23 18:33:51 +02:00
parent 52ecd59bf6
commit 7396cfc017
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
4 changed files with 11 additions and 11 deletions

View File

@ -138,7 +138,7 @@ class MediaAdminForm(ModelForm):
if not r:
return False
# If results, then take the most accurate
data = scraper.scrap_bd_info(r[0])
data = scraper.scrap_comic_info(r[0])
self.cleaned_data.update(data)
return True

View File

@ -44,7 +44,7 @@ class BedetequeScraper:
regex = r'href=\"(https://www\.bedetheque\.com/BD.*.html)\"'
return re.findall(regex, content)
def scrap_bd_info(self, bd_url: str) -> dict:
def scrap_comic_info(self, bd_url: str) -> dict:
"""
Load BD web page and scrap data
:param bd_url: URL where to find BD data

View File

@ -36,29 +36,29 @@ class TemplateTests(TestCase):
)
self.dummy_bd2.authors.add(self.dummy_author)
def test_bd_bd_changelist(self):
response = self.client.get(reverse('admin:media_bd_changelist'))
def test_comic_bd_changelist(self):
response = self.client.get(reverse('admin:media_comic_changelist'))
self.assertEqual(response.status_code, 200)
def test_bd_bd_add(self):
response = self.client.get(reverse('admin:media_bd_add'))
def test_comic_bd_add(self):
response = self.client.get(reverse('admin:media_comic_add'))
self.assertEqual(response.status_code, 200)
def test_bd_isbn_download(self):
def test_comic_isbn_download(self):
data = {
'_isbn': True,
'isbn': "0316358525",
}
response = self.client.post(reverse(
'admin:media_bd_change',
'admin:media_comic_change',
args=[self.dummy_bd1.id],
), data=data)
self.assertEqual(response.status_code, 302)
def test_bd_emprunt_changelist(self):
def test_comic_emprunt_changelist(self):
response = self.client.get(reverse('admin:media_emprunt_changelist'))
self.assertEqual(response.status_code, 200)
def test_bd_emprunt_add(self):
def test_comic_emprunt_add(self):
response = self.client.get(reverse('admin:media_emprunt_add'))
self.assertEqual(response.status_code, 200)

View File

@ -14,7 +14,7 @@ urlpatterns = [
path('find/', views.FindMediumView.as_view(), name="find"),
path('mark-as-present/bd/<int:pk>/',
views.MarkComicAsPresent.as_view(),
name="mark_bd_as_present"),
name="mark_comic_as_present"),
path('mark-as-present/manga/<int:pk>/',
views.MarkMangaAsPresent.as_view(),
name="mark_manga_as_present"),