Skip to content

Commit

Permalink
✅ [#317] Test for IntegrityError if it's duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhanCitil committed May 19, 2023
1 parent 94c3b75 commit 6103a73
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/objects/core/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from .factories import ObjectTypeFactory
from django.test import TestCase
from django.db import IntegrityError

class ObjectTypeTest(TestCase):
def test_duplicate_name(self):
ObjectTypeFactory.create(_name="test")
with self.assertRaises(IntegrityError):
ObjectTypeFactory.create(_name="test")

0 comments on commit 6103a73

Please sign in to comment.