def test_fetch_production_link_embed_data(self): pondlife = Production.objects.get(title='Pondlife') link = pondlife.links.create(link_class='SpeccyWikiPage', parameter='ldoVS0idTBw', is_download_link=False) ProductionLink.objects.filter(id=link.id).update( link_class='YoutubeVideo') fetch_production_link_embed_data(link.id) link.refresh_from_db() self.assertEqual(link.video_width, 1280)
def test_fetch_production_link_embed_data_error(self): pondlife = Production.objects.get(title='Pondlife') link = pondlife.links.create(link_class='SpeccyWikiPage', parameter='404', is_download_link=False) ProductionLink.objects.filter(id=link.id).update( link_class='YoutubeVideo') fetch_production_link_embed_data(link.id) link.refresh_from_db() self.assertTrue(link.embed_data_last_error_time)
def test_fetch_production_link_embed_data_errored_last_month(self): pondlife = Production.objects.get(title='Pondlife') link = pondlife.links.create( link_class='SpeccyWikiPage', parameter='ldoVS0idTBw', is_download_link=False ) ProductionLink.objects.filter(id=link.id).update( link_class='YoutubeVideo', embed_data_last_error_time=datetime.datetime(2020, 9, 20) ) fetch_production_link_embed_data(link.id) link.refresh_from_db() self.assertEqual(link.embed_data_last_error_time, datetime.datetime(2020, 9, 20)) self.assertEqual(link.embed_data_last_fetch_time, None)
def test_fetch_production_link_embed_data_non_existent(self): # non-existent link fetch_production_link_embed_data(9999)
def test_fetch_production_link_embed_data_non_existent(self): pondlife = Production.objects.get(title='Pondlife') # non-existent link fetch_production_link_embed_data(9999)