def test_refresh_issue(self): ci = ComicImporter() ci.refreshIssueData(self.issue_cvid) self.issue.refresh_from_db() self.assertTrue(self.issue.desc) self.assertTrue(self.issue.name)
def test_refresh_series(self): ci = ComicImporter() ci.refreshSeriesData(self.ser_cvid) self.bat.refresh_from_db() self.assertTrue(self.bat.desc) self.assertEqual(self.bat.year, 1940)
def test_issue_reader_view(self): ci = ComicImporter() ci.import_comic_files() issue = Issue.objects.get(cvid=8192) url = reverse('issue:reader', args=(issue.slug, )) resp = self.client.get(url) self.assertEqual(resp.status_code, HTML_OK_CODE)
def test_import_comic(self): ci = ComicImporter() ci.import_comic_files() cover_date = datetime.strptime('December 01, 1965', '%B %d, %Y') issue = Issue.objects.get(cvid=8192) self.assertEqual(str(issue), 'Captain Atom #078') self.assertEqual(issue.date, datetime.date(cover_date)) self.assertTrue(issue.cover)
def test_import_comic(self): ci = ComicImporter() ci.import_comic_files() cover_date = datetime.strptime('December 01, 1965', '%B %d, %Y') issue = Issue.objects.get(cvid=8192) # Change the issue leaf so we can check read_percent. leaf = issue.leaf issue.leaf = leaf + 2 issue.save() self.assertEqual(str(issue), 'Captain Atom #078') self.assertEqual(issue.percent_read, 12) self.assertEqual(issue.date, datetime.date(cover_date)) self.assertTrue(issue.image)
def test_get_page(self): ci = ComicImporter() ci.import_comic_files() role = Role.objects.get(id=1) issue = Issue.objects.get(cvid=8192) payload = utils.jwt_payload_handler(self.user) token = utils.jwt_encode_handler(payload) auth = 'JWT {0}'.format(token) resp = self.csrf_client.get(reverse('api:issue-get-page', kwargs={ 'slug': issue.slug, 'page': 1 }), HTTP_AUTHORIZATION=auth, format='json') self.assertEqual(resp.status_code, status.HTTP_200_OK) # Check the Role Models str() self.assertEqual(role.__str__(), role.name)
def test_refresh_arc(self): ci = ComicImporter() ci.refreshArcData(self.arc_cvid) self.arc.refresh_from_db() self.assertTrue(self.arc.desc)
def test_refresh_team(self): ci = ComicImporter() ci.refreshTeamData(self.team_cvid) self.jsa.refresh_from_db() self.assertTrue(self.jsa.desc)
def test_refresh_publisher(self): ci = ComicImporter() ci.refreshPublisherData(self.pub_cvid) self.dc.refresh_from_db() self.assertTrue(self.dc.desc)
def test_refresh_character(self): ci = ComicImporter() ci.refreshCharacterData(self.character_cvid) self.aquaman.refresh_from_db() self.assertTrue(self.aquaman.desc)
def test_refresh_creator(self): ci = ComicImporter() ci.refreshCreatorData(self.creator_cvid) self.creator.refresh_from_db() self.assertTrue(self.creator.desc)