Esempio n. 1
0
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]")
Esempio n. 2
0
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]")
Esempio n. 3
0
    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
Esempio n. 4
0
    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
Esempio n. 5
0
    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'
Esempio n. 6
0
    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"
Esempio n. 7
0
    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)
Esempio n. 8
0
    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
Esempio n. 9
0
    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)
Esempio n. 10
0
    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
Esempio n. 11
0
def test_nipsa_remove_redirects_to_index():
    request = DummyRequest(params={"remove": "kiki"})

    response = views.nipsa_remove(request)

    assert isinstance(response, httpexceptions.HTTPSeeOther)
Esempio n. 12
0
    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
Esempio n. 13
0
def test_nipsa_remove_redirects_to_index():
    request = DummyRequest(params={"remove": "kiki"})

    response = views.nipsa_remove(request)

    assert isinstance(response, httpexceptions.HTTPSeeOther)