mirror of
https://github.com/quantum5/qlinks.git
synced 2025-04-24 10:41:57 -04:00
Make tests neutral to settings
This commit is contained in:
parent
e43c5792c7
commit
ff74e1c502
|
@ -1,12 +1,16 @@
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from qlinks.email import send_broken_email
|
from qlinks.email import send_broken_email
|
||||||
from qlinks.models import Link
|
from qlinks.models import Link
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
QLINKS_CANONICAL='https://short.example/',
|
||||||
|
QLINKS_BROKEN_EMAIL=True,
|
||||||
|
)
|
||||||
class EmailTest(TestCase):
|
class EmailTest(TestCase):
|
||||||
def create_link(self, user) -> Link:
|
def create_link(self, user) -> Link:
|
||||||
return Link.objects.create(
|
return Link.objects.create(
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from qlinks.models import Link
|
from qlinks.models import Link
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(QLINKS_CANONICAL='https://short.example/')
|
||||||
class LinkTestCase(TestCase):
|
class LinkTestCase(TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
Link.objects.create(
|
Link.objects.create(
|
||||||
|
@ -14,7 +15,6 @@ class LinkTestCase(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_short_url(self):
|
def test_short_url(self):
|
||||||
with self.settings(QLINKS_CANONICAL='https://short.example/'):
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
Link.objects.get(short='short').short_url,
|
Link.objects.get(short='short').short_url,
|
||||||
'https://short.example/short'
|
'https://short.example/short'
|
||||||
|
|
Loading…
Reference in a new issue