mirror of
https://github.com/quantum5/qlinks.git
synced 2025-04-24 02:41:56 -04:00
Add simple test case
This commit is contained in:
parent
9a9f0d4cab
commit
86de70293c
0
qlinks/tests/__init__.py
Normal file
0
qlinks/tests/__init__.py
Normal file
21
qlinks/tests/test_model.py
Normal file
21
qlinks/tests/test_model.py
Normal 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'
|
||||
)
|
Loading…
Reference in a new issue