Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 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"
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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())
Exemplo n.º 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())