diff --git a/qlinks/tests/__init__.py b/qlinks/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/qlinks/tests/test_model.py b/qlinks/tests/test_model.py new file mode 100644 index 0000000..bd08882 --- /dev/null +++ b/qlinks/tests/test_model.py @@ -0,0 +1,21 @@ +from django.test import TestCase +from django.utils import timezone + +from qlinks.models import Link + + +class LinkTestCase(TestCase): + def setUp(self) -> None: + Link.objects.create( + short='short', + long='https://long.example.com', + is_working=True, + last_check=timezone.now(), + ) + + def test_short_url(self): + with self.settings(QLINKS_CANONICAL='https://short.example/'): + self.assertEqual( + Link.objects.get(short='short').short_url, + 'https://short.example/short' + )