server/test/unittest_repository.py
branchstable
changeset 8821 c4aa23af0baa
parent 8694 d901c36bcfce
parent 8820 dbffb6959564
child 8874 522bdba66690
--- a/server/test/unittest_repository.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/test/unittest_repository.py	Thu Mar 28 12:32:26 2013 +0100
@@ -51,6 +51,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: