from django.test import SimpleTestCase from ..src.utils import get_with_protocol class GetWithProtocolTests(SimpleTestCase): def test_missing_protocol_prepends_https(self): self.assertEqual(get_with_protocol("example.com"), "https://example.com") def test_missing_protocol_with_path(self): self.assertEqual( get_with_protocol("example.com/article"), "https://example.com/article", ) def test_upgrades_http_to_https(self): self.assertEqual(get_with_protocol("http://example.com"), "https://example.com") def test_preserves_https(self): self.assertEqual(get_with_protocol("https://example.com"), "https://example.com") def test_empty_string_becomes_https(self): self.assertEqual(get_with_protocol(""), "https://")