Skip to content

Commit 1bc0cb9

Browse files
committed
Simplify integration test helpers usage
1 parent da2dd92 commit 1bc0cb9

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

manage_breast_screening/notifications/tests/integration/test_create_appointments_from_azure_storage.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ def setup(self, monkeypatch):
1919
)
2020
monkeypatch.setenv("BLOB_CONTAINER_NAME", "nbss-appoinments-data")
2121

22+
@pytest.fixture
23+
def helpers(self):
24+
return Helpers()
25+
2226
@pytest.mark.django_db
23-
def test_appointments_created_from_file_stored_in_azure(self):
27+
def test_appointments_created_from_file_stored_in_azure(self, helpers):
2428
today_dirname = datetime.today().strftime("%Y-%m-%d")
2529

26-
with open(Helpers().test_dat_file_path()) as test_file:
27-
Helpers().add_to_blob_storage(f"{today_dirname}/test.dat", test_file.read())
30+
with open(helpers.test_dat_file_path()) as test_file:
31+
helpers.add_to_blob_storage(f"{today_dirname}/test.dat", test_file.read())
2832

2933
Command().handle(**{"date_str": today_dirname})
3034

manage_breast_screening/notifications/tests/integration/test_mesh_client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ def setup(self, monkeypatch):
1515
monkeypatch.setenv("MESH_CLIENT_SHARED_KEY", "TestKey")
1616
monkeypatch.setenv("MESH_INBOX_NAME", "X26ABC1")
1717

18-
def test_retrieve_file(self):
19-
test_file_path = f"{os.path.dirname(os.path.realpath(__file__))}/../management/commands/test.dat"
20-
Helpers().add_file_to_mesh_mailbox(test_file_path)
18+
@pytest.fixture
19+
def helpers(self):
20+
return Helpers()
21+
22+
def test_retrieve_file(self, helpers):
23+
test_file_path = helpers.test_dat_file_path()
24+
helpers.add_file_to_mesh_mailbox(test_file_path)
2125

2226
with MeshClient(
2327
url=os.getenv("MESH_BASE_URL"),

0 commit comments

Comments
 (0)