def test_run(self, upload_to_s3): skyrider = Production.objects.get(title="Skyrider") screenshot = Screenshot.objects.create( production=skyrider, original_url='http://kestra.exotica.org.uk/files/screenies/28000/154a.png', original_width=400, original_height=300 ) upload_to_s3.return_value = 'http://example.com/screens/skyrider.png' rebuild_screenshot(screenshot.id) screenshot.refresh_from_db() self.assertEqual(len(upload_to_s3.call_args_list), 3) self.assertEqual(screenshot.original_url, 'http://example.com/screens/skyrider.png') self.assertEqual(screenshot.original_width, 640)
def test_missing_screenshot(self): rebuild_screenshot(9999)