

def test_has_permission(self):
    'If permission is passed in and user has it, success.'
    req = self.req('post', '/the/url', data={
        'action-doit': '3',
    })
    req.user = Mock()
    req.user.has_perm.return_value = True
    res = self.view(req, decorator=self.actions(self.mock_model, ['doit'], permission='do_things'))
    self.assertEqual(res.status_code, 302)
    req.user.has_perm.assert_called_with('do_things')

dataset/ETHPy150Open mozilla/moztrap/tests/view/lists/test_actions.py ActionsTest.test_has_permission/original