server/test/unittest_repository.py
brancholdstable
changeset 8820 dbffb6959564
parent 8572 e54b3bc39011
child 8821 c4aa23af0baa
equal deleted inserted replaced
8818:d8b0984c923c 8820:dbffb6959564
    50 
    50 
    51 class RepositoryTC(CubicWebTC):
    51 class RepositoryTC(CubicWebTC):
    52     """ singleton providing access to a persistent storage for entities
    52     """ singleton providing access to a persistent storage for entities
    53     and relation
    53     and relation
    54     """
    54     """
       
    55 
       
    56     def test_uniquetogether(self):
       
    57         self.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"')
       
    58         with self.assertRaises(ValidationError) as wraperr:
       
    59             self.execute('INSERT Societe S: S nom "Logilab", S type "SSLL", S cp "75013"')
       
    60         self.assertEqual({'nom': u'violates unique_together constraints (cp, nom, type)',
       
    61                           'cp': u'violates unique_together constraints (cp, nom, type)',
       
    62                           'type': u'violates unique_together constraints (cp, nom, type)'},
       
    63                      wraperr.exception.args[1])
    55 
    64 
    56     def test_fill_schema(self):
    65     def test_fill_schema(self):
    57         origshema = self.repo.schema
    66         origshema = self.repo.schema
    58         try:
    67         try:
    59             self.repo.schema = CubicWebSchema(self.repo.config.appid)
    68             self.repo.schema = CubicWebSchema(self.repo.config.appid)