Пример #1
0
def test_staff_add_flashes_on_NoSuchUserError(make_staff):
    make_staff.side_effect = accounts.NoSuchUserError
    request = DummyRequest(params={"add": "seanh"})
    request.session.flash = Mock()

    admin.staff_add(request)

    assert request.session.flash.call_count == 1
Пример #2
0
def test_staff_add_flashes_on_NoSuchUserError(make_staff):
    make_staff.side_effect = accounts.NoSuchUserError
    request = DummyRequest(params={"add": "seanh"})
    request.session.flash = Mock()

    admin.staff_add(request)

    assert request.session.flash.call_count == 1
Пример #3
0
def test_staff_add_returns_index_on_success(staff_index):
    request = DummyRequest(params={"add": "seanh"})
    staff_index.return_value = "expected data"

    result = admin.staff_add(request)

    assert result == "expected data"
Пример #4
0
def test_staff_add_returns_index_on_success(staff_index):
    request = DummyRequest(params={"add": "seanh"})
    staff_index.return_value = "expected data"

    result = admin.staff_add(request)

    assert result == "expected data"
Пример #5
0
def test_staff_add_returns_index_on_NoSuchUserError(make_staff, staff_index):
    make_staff.side_effect = accounts.NoSuchUserError
    staff_index.return_value = "expected data"
    request = DummyRequest(params={"add": "seanh"})

    result = admin.staff_add(request)

    assert result == "expected data"
Пример #6
0
def test_staff_add_returns_index_on_NoSuchUserError(make_staff, staff_index):
    make_staff.side_effect = accounts.NoSuchUserError
    staff_index.return_value = "expected data"
    request = DummyRequest(params={"add": "seanh"})

    result = admin.staff_add(request)

    assert result == "expected data"
Пример #7
0
def test_staff_add_calls_make_staff(make_staff):
    request = DummyRequest(params={"add": "seanh"})

    admin.staff_add(request)

    make_staff.assert_called_once_with("seanh")
Пример #8
0
def test_staff_add_calls_make_staff(make_staff):
    request = DummyRequest(params={"add": "seanh"})

    admin.staff_add(request)

    make_staff.assert_called_once_with("seanh")
Пример #9
0
def test_staff_add_when_no_add_param():
    """It should 404 if the request has no "add" param."""
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.staff_add(DummyRequest())
Пример #10
0
def test_staff_add_when_no_add_param():
    """It should 404 if the request has no "add" param."""
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.staff_add(DummyRequest())