From 054e6e2bf3044efec5b53d3d6bf6ac229e4c4286 Mon Sep 17 00:00:00 2001 From: Rudolf Braun <48672663+BraunRudolf@users.noreply.github.com> Date: Sun, 8 Sep 2024 18:01:24 +0200 Subject: [PATCH] Extraxt env variable from tests --- tests/api_tests/test_api.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/tests/api_tests/test_api.py b/tests/api_tests/test_api.py index be1a34c..0211fe7 100644 --- a/tests/api_tests/test_api.py +++ b/tests/api_tests/test_api.py @@ -49,6 +49,13 @@ ] } +envs = { + "ENPHASE_CLIENT_ID": "1", + "ENPHASE_SYSTEM_ID": "1", + "ENPHASE_API_KEY": "test_key", + "ENPHASE_CLIENT_SECRET": "secret_secret", +} + @pytest.fixture def client(): @@ -143,12 +150,6 @@ def test_api_wrong_body(client, body_wrong): def test_getenphse_authorization_url(client, monkeypatch): - envs = { - "ENPHASE_CLIENT_ID": "1", - "ENPHASE_SYSTEM_ID": "1", - "ENPHASE_API_KEY": "test_key", - "ENPHASE_CLIENT_SECRET": "secret_secret", - } monkeypatch.setattr(os, "environ", envs) response = client.get("/solar_inverters/enphase/auth_url") @@ -158,12 +159,6 @@ def test_getenphse_authorization_url(client, monkeypatch): def test_getenphse_token_and_system_id_bad_redirect_url(client, bad_redirect_url, monkeypatch): - envs = { - "ENPHASE_CLIENT_ID": "1", - "ENPHASE_SYSTEM_ID": "1", - "ENPHASE_API_KEY": "test_key", - "ENPHASE_CLIENT_SECRET": "secret_secret", - } monkeypatch.setattr(os, "environ", envs) response = client.post( @@ -178,12 +173,6 @@ def test_getenphse_token_and_system_id_bad_redirect_url( client, bad_redirect_url_correct_param, monkeypatch ): - envs = { - "ENPHASE_CLIENT_ID": "1", - "ENPHASE_SYSTEM_ID": "1", - "ENPHASE_API_KEY": "test_key", - "ENPHASE_CLIENT_SECRET": "secret_secret", - } monkeypatch.setattr(os, "environ", envs) response = client.post(