Example #1
0
    def test_form_request_user_strips_spaces(
        self, nipsa_service, pyramid_request, users
    ):
        pyramid_request.params = {"add": "    carl   ", "authority": "   foo.org     "}

        nipsa_add(pyramid_request)

        assert users["carl"] in nipsa_service.flagged
Example #2
0
    def test_form_request_user_strips_spaces(
        self, nipsa_service, pyramid_request, users
    ):
        pyramid_request.params = {"add": "    carl   ", "authority": "   foo.org     "}

        nipsa_add(pyramid_request)

        assert users["carl"] in nipsa_service.flagged
Example #3
0
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        result = nipsa_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == "/adm/nipsa"
Example #4
0
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        result = nipsa_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/nipsa'
Example #5
0
    def test_add_raises_when_user_not_found(self, user, nipsa_service, pyramid_request):
        pyramid_request.params = {"add": user, "authority": "example.com"}

        with pytest.raises(UserNotFoundError):
            nipsa_add(pyramid_request)
Example #6
0
    def test_add_flags_user(self, nipsa_service, pyramid_request, users):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        nipsa_add(pyramid_request)

        assert users["carl"] in nipsa_service.flagged
Example #7
0
    def test_add_raises_when_user_not_found(self, user, nipsa_service,
                                            pyramid_request):
        pyramid_request.params = {"add": user, "authority": "example.com"}

        with pytest.raises(UserNotFoundError):
            nipsa_add(pyramid_request)
Example #8
0
    def test_add_flags_user(self, nipsa_service, pyramid_request, users):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        nipsa_add(pyramid_request)

        assert users['carl'] in nipsa_service.flagged