def test_add_strips_spaces(self, pyramid_request, users): pyramid_request.params = { "add": " eva ", "authority": " foo.org " } staff_add(pyramid_request) assert users['eva'].staff
def test_add_is_idempotent(self, pyramid_request, users): pyramid_request.params = { "add": "agnos", "authority": pyramid_request.authority } staff_add(pyramid_request) assert users['agnos'].staff
def test_add_flashes_when_user_not_found(self, pyramid_request): pyramid_request.params = { "add": "florp", "authority": pyramid_request.authority } pyramid_request.session.flash = mock.Mock() staff_add(pyramid_request) assert pyramid_request.session.flash.call_count == 1
def test_add_redirects_to_index_when_user_not_found(self, pyramid_request): pyramid_request.params = { "add": "florp", "authority": pyramid_request.authority } result = staff_add(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther) assert result.location == '/adm/staff'