test/unittest_schema.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1398 5fe84a5f7035
child 1977 606923dff11b
--- a/test/unittest_schema.py	Thu May 14 10:24:56 2009 +0200
+++ b/test/unittest_schema.py	Thu May 14 11:38:40 2009 +0200
@@ -96,7 +96,7 @@
                          ['Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s'])
         eperson.set_groups('read', ('managers',))
         self.assertEqual(eperson.get_groups('read'), set(('managers',)))
-        
+
     def test_relation_perms(self):
         rconcerne = schema.rschema('concerne')
         rconcerne.set_default_groups()
@@ -112,19 +112,19 @@
         self.assertRaises(RQLSyntaxError, ERQLExpression, '1')
         expr = ERQLExpression('X travaille S, S owned_by U')
         self.assertEquals(str(expr), 'Any X WHERE X travaille S, S owned_by U, X eid %(x)s, U eid %(u)s')
-        
+
     def test_rrqlexpression(self):
         self.assertRaises(Exception, RRQLExpression, '1')
         self.assertRaises(RQLSyntaxError, RRQLExpression, 'O X Y')
         expr = RRQLExpression('U has_update_permission O')
         self.assertEquals(str(expr), 'Any O WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s')
-        
+
 
 loader = CubicWebSchemaLoader()
 config = TestConfiguration('data')
 config.bootstrap_cubes()
 loader.lib_directory = config.schemas_lib_dir()
-    
+
 class SQLSchemaReaderClassTest(TestCase):
 
     def test_knownValues_include_schema_files(self):
@@ -139,15 +139,15 @@
         self.assertEquals(schema.name, 'data')
         entities = [str(e) for e in schema.entities()]
         entities.sort()
-        expected_entities = ['Bookmark', 'Boolean', 'Bytes', 'Card', 
+        expected_entities = ['Bookmark', 'Boolean', 'Bytes', 'Card',
                              'Date', 'Datetime', 'Decimal',
                              'CWCache', 'CWConstraint', 'CWConstraintType', 'CWEType',
                              'CWAttribute', 'CWGroup', 'EmailAddress', 'CWRelation',
                              'CWPermission', 'CWProperty', 'CWRType', 'CWUser',
                              'File', 'Float', 'Image', 'Int', 'Interval', 'Note',
                              'Password', 'Personne',
-                             'RQLExpression', 
-                             'Societe', 'State', 'String', 'SubNote', 'Tag', 'Time', 
+                             'RQLExpression',
+                             'Societe', 'State', 'String', 'SubNote', 'Tag', 'Time',
                              'Transition', 'TrInfo']
         self.assertListEquals(entities, sorted(expected_entities))
         relations = [str(r) for r in schema.relations()]
@@ -155,7 +155,7 @@
         expected_relations = ['add_permission', 'address', 'alias',
                               'allowed_transition', 'bookmarked_by', 'canonical',
 
-                              'cardinality', 'comment', 'comment_format', 
+                              'cardinality', 'comment', 'comment_format',
                               'composite', 'condition', 'connait', 'constrained_by', 'content',
                               'content_format', 'created_by', 'creation_date', 'cstrtype',
 
@@ -167,7 +167,7 @@
                               'final', 'firstname', 'for_user',
                               'from_entity', 'from_state', 'fulltext_container', 'fulltextindexed',
 
-                              'has_text', 
+                              'has_text',
                               'identical_to', 'identity', 'in_group', 'in_state', 'indexed',
                               'initial_state', 'inlined', 'internationalizable', 'is', 'is_instance_of',
 
@@ -179,20 +179,20 @@
 
                               'ordernum', 'owned_by',
 
-                              'path', 'pkey', 'prenom', 'primary_email', 
+                              'path', 'pkey', 'prenom', 'primary_email',
 
                               'read_permission', 'relation_type', 'require_group',
-                              
+
                               'specializes', 'state_of', 'surname', 'symetric', 'synopsis',
 
                               'tags', 'timestamp', 'title', 'to_entity', 'to_state', 'transition_of', 'travaille', 'type',
 
                               'upassword', 'update_permission', 'use_email',
 
-                              'value', 
+                              'value',
 
                               'wf_info_for', 'wikiid']
-    
+
         self.assertListEquals(relations, expected_relations)
 
         eschema = schema.eschema('CWUser')
@@ -234,16 +234,16 @@
         ex = self.assertRaises(BadSchemaDefinition,
                                self.loader._build_schema, 'toto', False)
         self.assertEquals(str(ex), msg)
-        
+
     def test_rrqlexpr_on_etype(self):
         self._test('rrqlexpr_on_eetype.py', "can't use RRQLExpression on an entity type, use an ERQLExpression (ToTo)")
-        
+
     def test_erqlexpr_on_rtype(self):
         self._test('erqlexpr_on_ertype.py', "can't use ERQLExpression on a relation type, use a RRQLExpression (toto)")
-        
+
     def test_rqlexpr_on_rtype_read(self):
         self._test('rqlexpr_on_ertype_read.py', "can't use rql expression for read permission of a relation type (toto)")
-        
+
     def test_rrqlexpr_on_attr(self):
         self._test('rrqlexpr_on_attr.py', "can't use RRQLExpression on a final relation type (eg attribute relation), use an ERQLExpression (attr)")