From 6103a7390994ac8543c0bbd74b3fa18743af8a22 Mon Sep 17 00:00:00 2001 From: Erhan <erhan.citil@maykinmedia.nl> Date: Fri, 19 May 2023 12:19:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20[#317]=20Test=20for=20IntegrityErro?= =?UTF-8?q?r=20if=20it's=20duplicate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/objects/core/tests/test_models.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/objects/core/tests/test_models.py diff --git a/src/objects/core/tests/test_models.py b/src/objects/core/tests/test_models.py new file mode 100644 index 00000000..d46530f8 --- /dev/null +++ b/src/objects/core/tests/test_models.py @@ -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") \ No newline at end of file