server/test/unittest_repository.py
brancholdstable
changeset 8820 dbffb6959564
parent 8572 e54b3bc39011
child 8821 c4aa23af0baa
--- a/server/test/unittest_repository.py	Thu Mar 28 11:45:17 2013 +0100
+++ b/server/test/unittest_repository.py	Thu Mar 28 12:31:39 2013 +0100
@@ -53,6 +53,15 @@
     and relation
     """
 
+    def test_uniquetogether(self):
+        self.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"')
+        with self.assertRaises(ValidationError) as wraperr:
+            self.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"')
+        self.assertEqual({'nom': u'violates unique_together constraints (cp, nom, type)',
+                          'cp': u'violates unique_together constraints (cp, nom, type)',
+                          'type': u'violates unique_together constraints (cp, nom, type)'},
+                     wraperr.exception.args[1])
+
     def test_fill_schema(self):
         origshema = self.repo.schema
         try: