web/test/unittest_views_basecontrollers.py
changeset 10083 afc5615aa92b
parent 10075 136b5f995f8e
child 10253 8eb9a3e9531c
equal deleted inserted replaced
10082:aa63a8e8c213 10083:afc5615aa92b
   810                 [['javascript']])
   810                 [['javascript']])
   811 
   811 
   812     def test_maydel_perms(self):
   812     def test_maydel_perms(self):
   813         """Check that AjaxEditRelationCtxComponent calls rdef.check with a
   813         """Check that AjaxEditRelationCtxComponent calls rdef.check with a
   814         sufficient context"""
   814         sufficient context"""
   815         self.remote_call('tag_entity', self.john.eid, ['python'])
   815         with self.remote_calling('tag_entity', self.john.eid, ['python']) as (_, req):
       
   816             req.cnx.commit()
   816         with self.temporary_permissions(
   817         with self.temporary_permissions(
   817                 (self.schema['tags'].rdefs['Tag', 'CWUser'],
   818                 (self.schema['tags'].rdefs['Tag', 'CWUser'],
   818                  {'delete': (RRQLExpression('S owned_by U'), )}, )):
   819                  {'delete': (RRQLExpression('S owned_by U'), )}, )):
   819             req = self.request(rql='CWUser P WHERE P login "John"',
   820             with self.admin_access.web_request(rql='CWUser P WHERE P login "John"',
   820                                pageid='123', fname='view')
   821                                    pageid='123', fname='view') as req:
   821             ctrl = self.ctrl(req)
   822                 ctrl = self.ctrl(req)
   822             rset = self.john.as_rset()
   823                 rset = self.john.as_rset()
   823             rset.req = req
   824                 rset.req = req
   824             source = ctrl.publish()
   825                 source = ctrl.publish()
   825             # maydel jscall
   826                 # maydel jscall
   826             self.assertIn('ajaxBoxRemoveLinkedEntity', source)
   827                 self.assertIn('ajaxBoxRemoveLinkedEntity', source)
   827 
   828 
   828     def test_pending_insertion(self):
   829     def test_pending_insertion(self):
   829         with self.remote_calling('add_pending_inserts', [['12', 'tags', '13']]) as (_, req):
   830         with self.remote_calling('add_pending_inserts', [['12', 'tags', '13']]) as (_, req):
   830             deletes = get_pending_deletes(req)
   831             deletes = get_pending_deletes(req)
   831             self.assertEqual(deletes, [])
   832             self.assertEqual(deletes, [])