From 86de70293c2a01cdab4c4ca006f7db328a25e2d8 Mon Sep 17 00:00:00 2001 From: Quantum Date: Mon, 24 Jan 2022 18:42:36 -0500 Subject: [PATCH] Add simple test case --- qlinks/tests/__init__.py | 0 qlinks/tests/test_model.py | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 qlinks/tests/__init__.py create mode 100644 qlinks/tests/test_model.py 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' + )