Skip to content
Snippets Groups Projects
Commit 9224e7ae1f6e authored by Graziella Toutoungis's avatar Graziella Toutoungis
Browse files

erelations_by_category from autoform

parent 9c750481ba12
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
from cubicweb.devtools.apptest import EnvBasedTC
from cubicweb.web.views.autoform import AutomaticEntityForm as aef
from cubicweb.web.views import actions, embedding
from cubes.link import views
......@@ -12,7 +13,8 @@
rset, req = self.env.get_rset_and_req('Link X')
self.assertEquals(self.pactionsdict(req, rset),
{'mainactions': [actions.ModifyAction, views.LinkFollowAction],
'moreactions': [actions.DeleteAction, actions.CopyAction,
'moreactions': [actions.ManagePermissionsAction,actions.DeleteAction,
actions.CopyAction,
embedding.EmbedAction],
})
......@@ -21,6 +23,6 @@
return [(rschema.type, x) for rschema, tschemas, x in iterable]
e = self.etype_instance('Link')
# we should only see embed when we are in the managers group
self.assertEquals(rbc(e.relations_by_category('secondary', 'add')),
self.assertEquals(rbc(aef.erelations_by_category(e, 'secondary', 'add')),
[('embed', 'subject'),
('description', 'subject')])
......@@ -25,8 +27,8 @@
[('embed', 'subject'),
('description', 'subject')])
self.assertEquals(rbc(e.relations_by_category('secondary', 'delete')),
self.assertEquals(rbc(aef.erelations_by_category(e,'secondary', 'delete')),
[('embed', 'subject'),
('description', 'subject')])
self.create_user('toto')
self.login('toto')
e = self.etype_instance('Link') # create a new instance with the new connection
......@@ -28,7 +30,7 @@
[('embed', 'subject'),
('description', 'subject')])
self.create_user('toto')
self.login('toto')
e = self.etype_instance('Link') # create a new instance with the new connection
self.assertEquals(rbc(e.relations_by_category('secondary', 'add')),
self.assertEquals(rbc(aef.erelations_by_category(e, 'secondary', 'add')),
[('description', 'subject')])
......@@ -34,5 +36,5 @@
[('description', 'subject')])
self.assertEquals(rbc(e.relations_by_category('secondary', 'delete')),
self.assertEquals(rbc(aef.erelations_by_category(e, 'secondary', 'delete')),
[('description', 'subject')])
if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment