From fb6afa955d1de095b269b453a7cd71a5b9fe6153 Mon Sep 17 00:00:00 2001 From: Razvan Vass <ze28pyvo@i10stud2.informatik.uni-erlangen.de.informatik.uni-erlangen.de> Date: Sun, 14 Apr 2024 17:14:41 +0200 Subject: [PATCH] You must to have .env in the main folder --- tests/test_dashboard_upload.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_dashboard_upload.py b/tests/test_dashboard_upload.py index 2caafef..e2ee2dd 100644 --- a/tests/test_dashboard_upload.py +++ b/tests/test_dashboard_upload.py @@ -7,16 +7,16 @@ import os def test_load_config_from_env(): # Case 1: Test if function raises exception for missing GRAFANA_API_KEY with pytest.raises(ValueError) as e: - load_config_from_env(env_path=".env") + load_config_from_env(env_path="../.env") assert str(e.value) == "GRAFANA_API_KEY is None or not defined in the .env file" # Case 2: Test if function raises exception for missing GRAFANA_SERVER with patch.dict(os.environ, {"GRAFANA_API_KEY": "api_key"}): with pytest.raises(ValueError) as e: - load_config_from_env(env_path=".env") + load_config_from_env(env_path="../.env") assert str(e.value) == "GRAFANA_SERVER is None or not defined in the .env file" # Case 3: Test if function returns expected values when both variables are defined with patch.dict(os.environ, {"GRAFANA_API_KEY": "api_key", "GRAFANA_SERVER": "server_url"}): - result = load_config_from_env(env_path=".env") + result = load_config_from_env(env_path="../.env") assert result == ("server_url", "api_key") \ No newline at end of file -- GitLab