def test_fix_redirect_url(self): for (test_input, expected_output) in ( ('https://google.com', 'https://google.com'), ('google.com', 'https://google.com'), ('https://www.google.com', 'https://www.google.com'), ): self.assertEqual( expected_output, utils.fix_redirect_url(test_input, 'https') ) self.assertEqual( 'http://google.com', utils.fix_redirect_url('google.com', 'http'), )
def clean_thanks_url(self): return fix_redirect_url(self.cleaned_data["thanks_url"], "http")
def clean_error_url(self): return fix_redirect_url(self.cleaned_data["error_url"], "http")
def clean_content_url(self): return fix_redirect_url(self.cleaned_data["content_url"], "http")