50 def test_cwuser_relations_by_category(self): |
50 def test_cwuser_relations_by_category(self): |
51 with self.admin_access.web_request() as req: |
51 with self.admin_access.web_request() as req: |
52 e = self.vreg['etypes'].etype_class('CWUser')(req) |
52 e = self.vreg['etypes'].etype_class('CWUser')(req) |
53 # see custom configuration in views.cwuser |
53 # see custom configuration in views.cwuser |
54 self.assertEqual(rbc(e, 'main', 'attributes'), |
54 self.assertEqual(rbc(e, 'main', 'attributes'), |
55 [('login', 'subject'), |
55 [('login', 'subject'), |
56 ('upassword', 'subject'), |
56 ('upassword', 'subject'), |
57 ('firstname', 'subject'), |
57 ('firstname', 'subject'), |
58 ('surname', 'subject'), |
58 ('surname', 'subject'), |
59 ('in_group', 'subject'), |
59 ('in_group', 'subject'), |
60 ]) |
60 ]) |
61 self.assertListEqual(rbc(e, 'muledit', 'attributes'), |
61 self.assertEqual(rbc(e, 'muledit', 'attributes'), |
62 [('login', 'subject'), |
62 [('login', 'subject'), |
63 ('upassword', 'subject'), |
63 ('upassword', 'subject'), |
64 ('in_group', 'subject'), |
64 ('in_group', 'subject'), |
65 ]) |
65 ]) |
66 self.assertListEqual(rbc(e, 'main', 'metadata'), |
66 self.assertCountEqual(rbc(e, 'main', 'metadata'), |
67 [('last_login_time', 'subject'), |
67 [('last_login_time', 'subject'), |
68 ('cw_source', 'subject'), |
68 ('cw_source', 'subject'), |
69 ('creation_date', 'subject'), |
69 ('creation_date', 'subject'), |
70 ('cwuri', 'subject'), |
70 ('cwuri', 'subject'), |
71 ('modification_date', 'subject'), |
71 ('modification_date', 'subject'), |
74 ('bookmarked_by', 'object'), |
74 ('bookmarked_by', 'object'), |
75 ]) |
75 ]) |
76 # XXX skip 'tags' relation here and in the hidden category because |
76 # XXX skip 'tags' relation here and in the hidden category because |
77 # of some test interdependancy when pytest is launched on whole cw |
77 # of some test interdependancy when pytest is launched on whole cw |
78 # (appears here while expected in hidden |
78 # (appears here while expected in hidden |
79 self.assertListEqual([x for x in rbc(e, 'main', 'relations') |
79 self.assertCountEqual([x for x in rbc(e, 'main', 'relations') |
80 if x != ('tags', 'object')], |
80 if x != ('tags', 'object')], |
81 [('connait', 'subject'), |
81 [('connait', 'subject'), |
82 ('custom_workflow', 'subject'), |
82 ('custom_workflow', 'subject'), |
83 ('primary_email', 'subject'), |
83 ('primary_email', 'subject'), |
84 ('checked_by', 'object'), |
84 ('checked_by', 'object'), |
122 ('salary', 'subject'), |
122 ('salary', 'subject'), |
123 ]) |
123 ]) |
124 self.assertListEqual(rbc(e, 'muledit', 'attributes'), |
124 self.assertListEqual(rbc(e, 'muledit', 'attributes'), |
125 [('nom', 'subject'), |
125 [('nom', 'subject'), |
126 ]) |
126 ]) |
127 self.assertListEqual(rbc(e, 'main', 'metadata'), |
127 self.assertCountEqual(rbc(e, 'main', 'metadata'), |
128 [('cw_source', 'subject'), |
128 [('cw_source', 'subject'), |
129 ('creation_date', 'subject'), |
129 ('creation_date', 'subject'), |
130 ('cwuri', 'subject'), |
130 ('cwuri', 'subject'), |
131 ('modification_date', 'subject'), |
131 ('modification_date', 'subject'), |
132 ('created_by', 'subject'), |
132 ('created_by', 'subject'), |
133 ('owned_by', 'subject'), |
133 ('owned_by', 'subject'), |
134 ]) |
134 ]) |
135 self.assertListEqual(rbc(e, 'main', 'relations'), |
135 self.assertCountEqual(rbc(e, 'main', 'relations'), |
136 [('travaille', 'subject'), |
136 [('travaille', 'subject'), |
137 ('manager', 'object'), |
137 ('manager', 'object'), |
138 ('connait', 'object'), |
138 ('connait', 'object'), |
139 ]) |
139 ]) |
140 self.assertListEqual(rbc(e, 'main', 'hidden'), |
140 self.assertListEqual(rbc(e, 'main', 'hidden'), |