diff --git a/qlinks/tests/test_email.py b/qlinks/tests/test_email.py index b592502..db86757 100644 --- a/qlinks/tests/test_email.py +++ b/qlinks/tests/test_email.py @@ -1,12 +1,16 @@ from django.contrib.auth.models import User from django.core import mail -from django.test import TestCase +from django.test import TestCase, override_settings from django.utils import timezone from qlinks.email import send_broken_email from qlinks.models import Link +@override_settings( + QLINKS_CANONICAL='https://short.example/', + QLINKS_BROKEN_EMAIL=True, +) class EmailTest(TestCase): def create_link(self, user) -> Link: return Link.objects.create( diff --git a/qlinks/tests/test_model.py b/qlinks/tests/test_model.py index bd08882..d6146e6 100644 --- a/qlinks/tests/test_model.py +++ b/qlinks/tests/test_model.py @@ -1,9 +1,10 @@ -from django.test import TestCase +from django.test import TestCase, override_settings from django.utils import timezone from qlinks.models import Link +@override_settings(QLINKS_CANONICAL='https://short.example/') class LinkTestCase(TestCase): def setUp(self) -> None: Link.objects.create( @@ -14,8 +15,7 @@ class LinkTestCase(TestCase): ) 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' - ) + self.assertEqual( + Link.objects.get(short='short').short_url, + 'https://short.example/short' + )