def test_provider_describe_by_data(self): image = ImageFactory() image.file = MockedUrlImageFile(image_url=test_image) provider = get_provider("wagtailaltgenerator.providers.cognitive.Cognitive") data = provider().describe(image) self.assertIsNotNone(data.description) self.assertTrue(len(data.tags) > 0)
def test_provider_describe(self): image = ImageFactory() image.file = MockedUrlImageFile(image_url=test_image) provider = get_provider( 'wagtailaltgenerator.providers.google_vision.GoogleVision') data = provider().describe(image) self.assertIsNone(data.description) self.assertTrue(len(data.tags) > 0)
def test_provider_describe_by_url(self): app_settings.ALT_GENERATOR_PREFER_UPLOAD = False image = ImageFactory() image.file = MockedUrlImageFile(image_url=test_image) provider = get_provider("wagtailaltgenerator.providers.cognitive.Cognitive") data = provider().describe(image) self.assertIsNotNone(data.description) self.assertTrue(len(data.tags) > 0) app_settings.ALT_GENERATOR_PREFER_UPLOAD = True