示例#1
0
 def test_set_status_refuse_manager_ok(self):
     self.config.testing_securitypolicy(userid=u'manager1',
                                        permissive=True)
     from pyvac.models import Request
     from pyvac.views.request import Refuse
     req_id = 1
     req = Request.by_id(self.session, req_id)
     orig_status = req.status
     status = Refuse(self.create_request({'request_id': req_id}))()
     self.assertEqual(status, u'DENIED')
     self.session.commit()
     self.assertEqual(req.status, u'DENIED')
     self.assertEqual(req.notified, False)
     req.update_status(orig_status)
示例#2
0
 def test_set_status_refuse_admin_reason_ok(self):
     self.config.testing_securitypolicy(userid='admin',
                                        permissive=True)
     from pyvac.models import Request
     from pyvac.views.request import Refuse
     req_id = 1
     req = Request.by_id(self.session, req_id)
     orig_status = req.status
     status = Refuse(self.create_request({'request_id': req_id,
                                          'reason': 'we need you'}))()
     self.assertEqual(status, 'DENIED')
     self.session.commit()
     self.assertEqual(req.status, 'DENIED')
     self.assertEqual(req.notified, False)
     self.assertEqual(req.reason, 'we need you')
     req.update_status(orig_status)