def test_DownloadBotTemplate(self): # generate a fake target model_output = MockTarget("DownloadBotTemplate", format=format.Nop) # make a mock of DownloadImage class MockDownloadBotTemplate(DownloadBotTemplate): def output(self): return model_output self.assertFalse(model_output.exists()) build([MockDownloadBotTemplate()], local_scheduler=True) self.assertTrue(model_output.exists())
def test_DownloadHtml(self): # generate a fake target image_output = MockTarget("DownloadHTMLTemplate", format=format.Nop) # make a mock of DownloadImage class MockDownloadHtml(DownloadHTMLTemplate): # Essentially here I want to override the output thanks to inheritance! Change this to a mock output instead def output(self): return image_output # make sure the output starts out as false self.assertFalse(image_output.exists()) # run the task build([MockDownloadHtml()], local_scheduler=True) # make sure the output is now true self.assertTrue(image_output.exists())
def test_download_image(self): with TemporaryDirectory() as tmpdir: my_fake_file = "asdf.jpg" # upload fake image file to s3 bucket mock_output = MockTarget("...") class MockDownloadImage(MyPSET4Task): # Essentially here I want to override the output thanks to inheritance! Change this to a mock output instead def output(self): return ... run_task(MockDownloadImage(filename="...")) self.assertTrue(mock_output.exists())