示例#1
0
    def test_add_flashes_when_user_not_found(self):
        request = DummyRequest(params={"add": "florp"})
        request.session.flash = Mock()

        views.admins_add(request)

        assert request.session.flash.call_count == 1
示例#2
0
    def test_add_flashes_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {"add": "florp"}
        pyramid_request.session.flash = mock.Mock()

        views.admins_add(pyramid_request)

        assert pyramid_request.session.flash.call_count == 1
示例#3
0
    def test_add_flashes_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {"add": "florp"}
        pyramid_request.session.flash = mock.Mock()

        views.admins_add(pyramid_request)

        assert pyramid_request.session.flash.call_count == 1
示例#4
0
def test_admins_add_flashes_on_NoSuchUserError(make_admin):
    make_admin.side_effect = accounts.NoSuchUserError
    request = DummyRequest(params={"add": "seanh"})
    request.session.flash = Mock()

    views.admins_add(request)

    assert request.session.flash.call_count == 1
示例#5
0
def test_admins_add_flashes_on_NoSuchUserError(make_admin):
    make_admin.side_effect = accounts.NoSuchUserError
    request = DummyRequest(params={"add": "seanh"})
    request.session.flash = Mock()

    views.admins_add(request)

    assert request.session.flash.call_count == 1
示例#6
0
    def test_add_strips_spaces(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "   david   ",
            "authority": "   example.com  "
        }

        views.admins_add(pyramid_request)

        assert users['david'].admin
示例#7
0
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "agnos",
            "authority": pyramid_request.auth_domain,
        }

        views.admins_add(pyramid_request)

        assert users['agnos'].admin
示例#8
0
    def test_add_makes_users_admins(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "eva",
            "authority": 'foo.org',
        }

        views.admins_add(pyramid_request)

        assert users['eva'].admin
示例#9
0
文件: admins_test.py 项目: nlisgo/h
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "agnos",
            "authority": pyramid_request.auth_domain,
        }

        views.admins_add(pyramid_request)

        assert users['agnos'].admin
示例#10
0
文件: admins_test.py 项目: nlisgo/h
    def test_add_makes_users_admins(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "eva",
            "authority": 'foo.org',
        }

        views.admins_add(pyramid_request)

        assert users['eva'].admin
示例#11
0
def test_admins_add_returns_index_on_success(admins_index):
    request = DummyRequest(params={"add": "seanh"})
    admins_index.return_value = "expected data"

    result = views.admins_add(request)

    assert result == "expected data"
示例#12
0
    def test_add_redirects_to_index_when_user_not_found(self):
        request = DummyRequest(params={"add": "florp"})

        result = views.admins_add(request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/admins'
示例#13
0
def test_admins_add_returns_index_on_success(admins_index):
    request = DummyRequest(params={"add": "seanh"})
    admins_index.return_value = "expected data"

    result = views.admins_add(request)

    assert result == "expected data"
示例#14
0
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {"add": "eva"}

        result = views.admins_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/admins'
示例#15
0
    def test_add_redirects_to_index_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {"add": "florp"}

        result = views.admins_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == "/adm/admins"
示例#16
0
def test_admins_add_returns_index_on_NoSuchUserError(make_admin, admins_index):
    make_admin.side_effect = accounts.NoSuchUserError
    admins_index.return_value = "expected data"
    request = DummyRequest(params={"add": "seanh"})

    result = views.admins_add(request)

    assert result == "expected data"
示例#17
0
def test_admins_add_returns_index_on_NoSuchUserError(make_admin, admins_index):
    make_admin.side_effect = accounts.NoSuchUserError
    admins_index.return_value = "expected data"
    request = DummyRequest(params={"add": "seanh"})

    result = views.admins_add(request)

    assert result == "expected data"
示例#18
0
文件: admins_test.py 项目: nlisgo/h
    def test_add_redirects_to_index(self, pyramid_request):
        pyramid_request.params = {
            "add": "eva",
            "authority": pyramid_request.auth_domain,
        }

        result = views.admins_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/admins'
示例#19
0
    def test_add_redirects_to_index_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {
            "add": "florp",
            "authority": pyramid_request.auth_domain,
        }

        result = views.admins_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/admins'
示例#20
0
    def test_add_makes_users_admins(self, pyramid_request, users):
        pyramid_request.params = {"add": "eva"}

        views.admins_add(pyramid_request)

        assert users['eva'].admin
示例#21
0
文件: admins_test.py 项目: nlisgo/h
    def test_add_strips_spaces(self, pyramid_request, users):
        pyramid_request.params = {"add": "   david   ", "authority": "   example.com  "}

        views.admins_add(pyramid_request)

        assert users['david'].admin
示例#22
0
def test_admins_add_calls_make_admin(make_admin):
    request = DummyRequest(params={"add": "seanh"})

    views.admins_add(request)

    make_admin.assert_called_once_with("seanh")
示例#23
0
    def test_add_makes_users_admins(self, pyramid_request, users):
        pyramid_request.params = {"add": "eva"}

        views.admins_add(pyramid_request)

        assert users["eva"].admin
示例#24
0
    def test_add_is_idempotent(self, users):
        request = DummyRequest(params={"add": "agnos"})

        views.admins_add(request)

        assert users['agnos'].admin
示例#25
0
    def test_add_makes_users_admins(self, users):
        request = DummyRequest(params={"add": "eva"})

        views.admins_add(request)

        assert users['eva'].admin
示例#26
0
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {"add": "agnos"}

        views.admins_add(pyramid_request)

        assert users["agnos"].admin
示例#27
0
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {"add": "agnos"}

        views.admins_add(pyramid_request)

        assert users['agnos'].admin
示例#28
0
def test_admins_add_calls_make_admin(make_admin):
    request = DummyRequest(params={"add": "seanh"})

    views.admins_add(request)

    make_admin.assert_called_once_with("seanh")