示例#1
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()

    admin.admins_add(request)

    assert request.session.flash.call_count == 1
示例#2
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()

    admin.admins_add(request)

    assert request.session.flash.call_count == 1
示例#3
0
def test_admins_add_returns_index_on_success(admins_index):
    request = DummyRequest(params={"add": "seanh"})
    admins_index.return_value = "expected data"

    result = admin.admins_add(request)

    assert result == "expected data"
示例#4
0
def test_admins_add_returns_index_on_success(admins_index):
    request = DummyRequest(params={"add": "seanh"})
    admins_index.return_value = "expected data"

    result = admin.admins_add(request)

    assert result == "expected data"
示例#5
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 = admin.admins_add(request)

    assert result == "expected data"
示例#6
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 = admin.admins_add(request)

    assert result == "expected data"
示例#7
0
def test_admins_add_calls_make_admin(make_admin):
    request = DummyRequest(params={"add": "seanh"})

    admin.admins_add(request)

    make_admin.assert_called_once_with("seanh")
示例#8
0
def test_admins_add_calls_make_admin(make_admin):
    request = DummyRequest(params={"add": "seanh"})

    admin.admins_add(request)

    make_admin.assert_called_once_with("seanh")
示例#9
0
文件: admin_test.py 项目: hylhero/h
def test_admins_add_when_no_add_param():
    """It should 404 if the request has no "add" param."""
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.admins_add(DummyRequest())
示例#10
0
文件: admin_test.py 项目: ningyifan/h
def test_admins_add_when_no_add_param():
    """It should 404 if the request has no "add" param."""
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.admins_add(DummyRequest())