-
-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Description
HI, I have a scenario to test failing auth by updating the variable set in pytest.ini
env =
API_TOKEN=1234correct
In some class
load_env()
TOKEN = os.getenv('API_TOKEN')
Now in test I would like to modify its value so the authentication will fail
test_auth.py
def test_it(monkeypatch):
os.unsetenv("API_TOKEN")
print(os.getenv('API_TOKEN')) // its still there
monkeypatch.setenv("API_TOKEN", 1234wrong)
Metadata
Metadata
Assignees
Labels
No labels