def test_remove_nipsa_calls_nipsa_api_with_userid(nipsa_api): request = mock.Mock(params={"remove": "kiki"}, domain="hypothes.is") nipsa.remove_nipsa(request) nipsa_api.remove_nipsa.assert_called_once_with( request, "acct:[email protected]")
def test_remove_nipsa_redirects_to_index(nipsa_api): request = mock.Mock( params={"remove": "kiki"}, domain="hypothes.is", route_url=mock.Mock(return_value="/nipsa")) response = nipsa.remove_nipsa(request) assert isinstance(response, httpexceptions.HTTPSeeOther) assert response.location == "/nipsa"
def nipsa_remove(request): username = request.params["remove"] userid = util.user.userid_from_username(username, request) nipsa.remove_nipsa(request, userid) return httpexceptions.HTTPSeeOther( location=request.route_url("admin_nipsa"))