Esempio n. 1
0
def test_staff_remove_calls_get_by_username(User):
    User.staff_members.return_value = [Mock(username="******"),
                                       Mock(username="******"),
                                       Mock(username="******")]
    request = DummyRequest(params={"remove": "fred"})

    admin.staff_remove(request)

    User.get_by_username.assert_called_once_with("fred")
Esempio n. 2
0
def test_staff_remove_calls_get_by_username(User):
    User.staff_members.return_value = [Mock(username="******"),
                                       Mock(username="******"),
                                       Mock(username="******")]
    request = DummyRequest(params={"remove": "fred"})
    request.route_url = Mock()

    admin.staff_remove(request)

    User.get_by_username.assert_called_once_with("fred")
Esempio n. 3
0
def test_staff_remove_sets_staff_to_False(User):
    User.staff_members.return_value = [Mock(username="******"),
                                       Mock(username="******"),
                                       Mock(username="******")]
    request = DummyRequest(params={"remove": "fred"})
    user = Mock(staff=True)
    User.get_by_username.return_value = user

    admin.staff_remove(request)

    assert user.staff is False
Esempio n. 4
0
def test_staff_remove_sets_staff_to_False(User):
    User.staff_members.return_value = [Mock(username="******"),
                                       Mock(username="******"),
                                       Mock(username="******")]
    request = DummyRequest(params={"remove": "fred"})
    request.route_url = Mock()
    user = Mock(staff=True)
    User.get_by_username.return_value = user

    admin.staff_remove(request)

    assert user.staff is False
Esempio n. 5
0
def test_staff_remove_404s_if_no_remove_param():
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.staff_remove(DummyRequest())
Esempio n. 6
0
def test_staff_remove_404s_if_no_remove_param():
    with pytest.raises(httpexceptions.HTTPNotFound):
        admin.staff_remove(DummyRequest())