@mock.patch("h.accounts.models.User.get_by_username")
def test_make_staff_raises_if_user_does_not_exist(get_by_username):
    get_by_username.return_value = None

    with pytest.raises(accounts.NoSuchUserError):
        accounts.make_staff("fred")


# The fixtures required to mock all of get_user()'s dependencies.
It should raise NoSuchUserError if the user doesn't exist.
dataset/ETHPy150Open hypothesis/h/h/accounts/test/__init___test.py/test_make_staff_raises_if_user_does_not_exist