Add simple test case

This commit is contained in:
Quantum 2022-01-24 18:42:36 -05:00
parent 9a9f0d4cab
commit 86de70293c
2 changed files with 21 additions and 0 deletions

0
qlinks/tests/__init__.py Normal file
View file

View file

@ -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'
)