17 lines
548 B
Python
17 lines
548 B
Python
|
from django.db import IntegrityError
|
||
|
from django.test import TestCase
|
||
|
from model_bakery import baker
|
||
|
|
||
|
|
||
|
class RedirectModelTestCase(TestCase):
|
||
|
def test_has_short_code(self):
|
||
|
baker.make("Redirect", short_code="potain3")
|
||
|
|
||
|
def test_short_code_is_unique(self):
|
||
|
baker.make("Redirect", short_code="potain3")
|
||
|
with self.assertRaises(IntegrityError):
|
||
|
baker.make("Redirect", short_code="potain3")
|
||
|
|
||
|
def test_has_target_url(self):
|
||
|
baker.make("Redirect", target_url="https://static.augendre.info/potain3")
|