web/test/unittest_views_editforms.py
branchstable
changeset 4570 ede247bbbf62
parent 4252 6c4f109c2b03
child 4677 c701aac36f5c
--- a/web/test/unittest_views_editforms.py	Mon Feb 15 15:05:15 2010 +0100
+++ b/web/test/unittest_views_editforms.py	Mon Feb 15 15:10:25 2010 +0100
@@ -16,7 +16,11 @@
 AFS = uicfg.autoform_section
 
 def rbc(entity, formtype, section):
-    return [(rschema.type, x) for rschema, tschemas, x in AFS.relations_by_section(entity, formtype, section)]
+    if section in ('attributes', 'metadata', 'hidden'):
+        permission = 'update'
+    else:
+        permission = 'add'
+    return [(rschema.type, x) for rschema, tschemas, x in AFS.relations_by_section(entity, formtype, section, permission)]
 
 class AutomaticEntityFormTC(CubicWebTC):
 
@@ -69,19 +73,16 @@
                               [('use_email', 'subject'),
                                ])
         # owned_by is defined both as subject and object relations on CWUser
-        self.assertListEquals(rbc(e, 'main', 'hidden'),
-                              [('in_state', 'subject'),
-                               ('is', 'subject'),
-                               ('is_instance_of', 'subject'),
-                               ('has_text', 'subject'),
-                               ('identity', 'subject'),
-                               ('tags', 'object'),
-                               ('for_user', 'object'),
-                               ('created_by', 'object'),
-                               ('wf_info_for', 'object'),
-                               ('owned_by', 'object'),
-                               ('identity', 'object'),
-                               ])
+        self.assertListEquals(sorted(rbc(e, 'main', 'hidden')),
+                              sorted([('has_text', 'subject'),
+                                      ('identity', 'subject'),
+                                      ('tags', 'object'),
+                                      ('for_user', 'object'),
+                                      ('created_by', 'object'),
+                                      ('wf_info_for', 'object'),
+                                      ('owned_by', 'object'),
+                                      ('identity', 'object'),
+                                      ]))
 
     def test_inlined_view(self):
         self.failUnless('main_inlined' in AFS.etype_get('CWUser', 'use_email', 'subject', 'EmailAddress'))
@@ -122,10 +123,8 @@
                                ('connait', 'object')
                                ])
         self.assertListEquals(rbc(e, 'main', 'hidden'),
-                              [('is', 'subject'),
-                               ('has_text', 'subject'),
+                              [('has_text', 'subject'),
                                ('identity', 'subject'),
-                               ('is_instance_of', 'subject'),
                                ('identity', 'object'),
                                ])