def test_fix_image_url(self): for (test_input, expected_output) in ( ('example.com/test.jpeg', 'https://example.com/test.jpeg'), ('//example.com/test.jpeg', '//example.com/test.jpeg'), ('http://example.com/test.jpeg', 'http://example.com/test.jpeg'), ('https://example.com/test.jpeg', 'https://example.com/test.jpeg'), ): self.assertEqual( expected_output, utils.fix_image_url(test_input) )
def clean_og_image(self): og_image = self.cleaned_data["og_image"] return fix_image_url(og_image)