Clean up unique on existing models

This commit is contained in:
Matthew Ryan Dillon 2016-06-16 06:45:59 -07:00
parent a44ac2fa81
commit 49eacdeef4
16 changed files with 141 additions and 12 deletions

View file

@ -42,6 +42,13 @@ class FlawTestCase(TestCase):
self.assertTrue(isinstance(f, Flaw))
self.assertEqual(f.__str__(), f.name)
def test_uniqueness(self):
f1 = FlawFactory()
with transaction.atomic(), self.assertRaises(IntegrityError):
FlawFactory(name=f1.name)
f3 = FlawFactory()
self.assertTrue(isinstance(f3, Flaw))
class ADFGPermitTestCase(TestCase):
def test_creation(self):
@ -49,6 +56,13 @@ class ADFGPermitTestCase(TestCase):
self.assertTrue(isinstance(a, ADFGPermit))
self.assertEqual(a.__str__(), a.name)
def test_uniqueness(self):
a1 = ADFGPermitFactory()
with transaction.atomic(), self.assertRaises(IntegrityError):
ADFGPermitFactory(name=a1.name)
a3 = ADFGPermitFactory()
self.assertTrue(isinstance(a3, ADFGPermit))
class CollectionTestCase(TestCase):
def test_creation(self):