Merge pull request #437 from Hestia-Homes/remote-assessment-api

moving test setup
This commit is contained in:
KhalimCK 2025-05-15 17:42:45 +01:00 committed by GitHub
commit b3eaa16380
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,11 +1,19 @@
import pytest
import os
from backend.SearchEpc import SearchEpc # Replace with your actual module name
from dotenv import load_dotenv
EPC_AUTH_TOKEN = os.getenv("EPC_AUTH_TOKEN")
# If this backend/.env file is present, we load it
if os.path.exists("backend/.env"):
load_dotenv("backend/.env")
class TestSearchEpcIntegration:
@pytest.fixture
def epc_auth_token(self):
return os.getenv("EPC_AUTH_TOKEN")
@pytest.mark.parametrize(
"address, postcode, uprn, skip_os, lmk_key, n_old_epcs",
[
@ -27,7 +35,7 @@ class TestSearchEpcIntegration:
],
)
def test_find_property(self, address, postcode, uprn, skip_os, lmk_key, n_old_epcs):
def test_find_property(self, epc_auth_token, address, postcode, uprn, skip_os, lmk_key, n_old_epcs):
"""
Integration test for `find_property`, making actual API calls.
"""
@ -39,7 +47,7 @@ class TestSearchEpcIntegration:
address1=address,
postcode=postcode,
uprn=uprn,
auth_token=EPC_AUTH_TOKEN,
auth_token=epc_auth_token,
os_api_key=os_api_key,
)