def test_nipsa_remove_calls_nipsa_api_with_userid(nipsa): request = DummyRequest(params={"remove": "kiki"}) views.nipsa_remove(request) nipsa.remove_nipsa.assert_called_once_with( request, "acct:[email protected]")
def test_nipsa_remove_calls_nipsa_api_with_userid(nipsa): request = DummyRequest(params={"remove": "kiki"}) views.nipsa_remove(request) nipsa.remove_nipsa.assert_called_once_with(request, "acct:[email protected]")
def test_remove_raises_when_user_not_found(self, user, nipsa_service, pyramid_request): # Add this bogus userid just to make sure it doesn't get removed. nonexistent_userid = 'acct:{0}@example.com'.format(user) nipsa_service.flagged.add(nonexistent_userid) pyramid_request.params = {"remove": user} with pytest.raises(views.UserNotFoundError): views.nipsa_remove(pyramid_request) assert nonexistent_userid in nipsa_service.flagged
def test_remove_redirects_to_index(self, pyramid_request): pyramid_request.params = {"remove": "kiki"} result = views.nipsa_remove(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther) assert result.location == '/adm/nipsa'
def test_remove_redirects_to_index(self, pyramid_request): pyramid_request.params = {"remove": "acct:[email protected]"} result = views.nipsa_remove(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther) assert result.location == "/adm/nipsa"
def test_remove_raises_when_user_not_found(self, user, nipsa_service, pyramid_request): pyramid_request.params = {"remove": user} with pytest.raises(views.UserNotFoundError): views.nipsa_remove(pyramid_request)
def test_remove_unflags_user(self, nipsa_service, pyramid_request, users): pyramid_request.params = {"remove": "kiki"} views.nipsa_remove(pyramid_request) assert users['kiki'] not in nipsa_service.flagged
def test_remove_unflags_user(self, nipsa_service, pyramid_request, users): pyramid_request.params = {"remove": "acct:[email protected]"} views.nipsa_remove(pyramid_request) assert users["kiki"] not in nipsa_service.flagged
def test_nipsa_remove_redirects_to_index(): request = DummyRequest(params={"remove": "kiki"}) response = views.nipsa_remove(request) assert isinstance(response, httpexceptions.HTTPSeeOther)
def test_remove_unflags_user(self, nipsa_service, pyramid_request): pyramid_request.params = {"remove": "kiki"} views.nipsa_remove(pyramid_request) assert 'acct:[email protected]' not in nipsa_service.flagged