Ejemplo n.º 1
0
    def test_add_raises_when_user_not_found(self, user, nipsa_service, pyramid_request):
        pyramid_request.params = {"add": user}

        with pytest.raises(views.UserNotFoundError):
            views.nipsa_add(pyramid_request)

        assert 'acct:@example.com' not in nipsa_service.flagged
Ejemplo n.º 2
0
def test_nipsa_add_calls_nipsa_api_with_userid(nipsa):
    request = DummyRequest(params={"add": "kiki"})

    views.nipsa_add(request)

    nipsa.add_nipsa.assert_called_once_with(
        request, "acct:[email protected]")
Ejemplo n.º 3
0
    def test_add_raises_when_user_not_found(self, user, nipsa_service,
                                            pyramid_request):
        pyramid_request.params = {"add": user}

        with pytest.raises(views.UserNotFoundError):
            views.nipsa_add(pyramid_request)

        assert 'acct:@example.com' not in nipsa_service.flagged
Ejemplo n.º 4
0
    def test_form_request_user_strips_spaces(self, nipsa_service,
                                             pyramid_request, users):
        pyramid_request.params = {
            "add": "    carl   ",
            "authority": "   foo.org     "
        }

        views.nipsa_add(pyramid_request)

        assert users['carl'] in nipsa_service.flagged
Ejemplo n.º 5
0
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {"add": "carl"}

        result = views.nipsa_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/nipsa'
Ejemplo n.º 6
0
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        result = views.nipsa_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == "/adm/nipsa"
Ejemplo n.º 7
0
    def test_add_raises_when_user_not_found(self, user, nipsa_service,
                                            pyramid_request):
        pyramid_request.params = {"add": user}

        with pytest.raises(views.UserNotFoundError):
            views.nipsa_add(pyramid_request)
Ejemplo n.º 8
0
    def test_add_flags_user(self, nipsa_service, pyramid_request, users):
        pyramid_request.params = {"add": "carl"}

        views.nipsa_add(pyramid_request)

        assert users['carl'] in nipsa_service.flagged
Ejemplo n.º 9
0
    def test_form_request_user_strips_spaces(self, nipsa_service, pyramid_request, users):
        pyramid_request.params = {"add": "    carl   ", "authority": "   foo.org     "}

        views.nipsa_add(pyramid_request)

        assert users["carl"] in nipsa_service.flagged
Ejemplo n.º 10
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(views.UserNotFoundError):
            views.nipsa_add(pyramid_request)
Ejemplo n.º 11
0
    def test_add_flags_user(self, nipsa_service, pyramid_request, users):
        pyramid_request.params = {"add": "carl", "authority": "foo.org"}

        views.nipsa_add(pyramid_request)

        assert users['carl'] in nipsa_service.flagged
Ejemplo n.º 12
0
    def test_add_flags_user(self, nipsa_service, pyramid_request):
        pyramid_request.params = {"add": "carl"}

        views.nipsa_add(pyramid_request)

        assert 'acct:[email protected]' in nipsa_service.flagged
Ejemplo n.º 13
0
def test_nipsa_add_returns_index(nipsa_index):
    request = DummyRequest(params={"add": "kiki"})
    nipsa_index.return_value = "Keine Bange!"

    assert views.nipsa_add(request) == "Keine Bange!"
Ejemplo n.º 14
0
    def test_add_flags_user(self, nipsa_service, pyramid_request):
        pyramid_request.params = {"add": "carl"}

        views.nipsa_add(pyramid_request)

        assert 'acct:[email protected]' in nipsa_service.flagged
Ejemplo n.º 15
0
def test_nipsa_add_returns_index(nipsa_index):
    request = DummyRequest(params={"add": "kiki"})
    nipsa_index.return_value = "Keine Bange!"

    assert views.nipsa_add(request) == "Keine Bange!"
Ejemplo n.º 16
0
def test_nipsa_add_calls_nipsa_api_with_userid(nipsa):
    request = DummyRequest(params={"add": "kiki"})

    views.nipsa_add(request)

    nipsa.add_nipsa.assert_called_once_with(request, "acct:[email protected]")