From dd07cd7959a1b8fc91915c8887f7845c0c22ab94 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 23 Jan 2023 18:21:23 +0100 Subject: [PATCH] Test formatting --- tests/test_integration/test_connections.py | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/test_integration/test_connections.py b/tests/test_integration/test_connections.py index a3349a4..771baa3 100644 --- a/tests/test_integration/test_connections.py +++ b/tests/test_integration/test_connections.py @@ -35,14 +35,20 @@ def test_temporal_download_of_secret_file_works_properly_in_happy_path(): with _temp_secret_file_from_s3( TEST_LOLACONFIG.S3_BUCKET_NAME, - s3_file_key="env/env_prd.json", # Not a secret file, but then again, this is a test, - local_temp_file_path=temp_file_name + s3_file_key="env/env_prd.json", # Not a secret file, but then again, this is a test, + local_temp_file_path=temp_file_name, ) as temp: temp_file_found_when_in_context_manager = pathlib.Path(temp).exists() - temp_file_missing_when_outside_context_manager = not pathlib.Path(temp_file_name).exists() + temp_file_missing_when_outside_context_manager = not pathlib.Path( + temp_file_name + ).exists() + + assert ( + temp_file_found_when_in_context_manager + and temp_file_missing_when_outside_context_manager + ) - assert temp_file_found_when_in_context_manager and temp_file_missing_when_outside_context_manager def test_temporal_download_of_secret_file_works_properly_even_with_exception(): temp_file_name = "test_temp_file" @@ -50,14 +56,19 @@ def test_temporal_download_of_secret_file_works_properly_even_with_exception(): try: with _temp_secret_file_from_s3( TEST_LOLACONFIG.S3_BUCKET_NAME, - s3_file_key="env/env_prd.json", # Not a secret file, but then again, this is a test, - local_temp_file_path=temp_file_name + s3_file_key="env/env_prd.json", # Not a secret file, but then again, this is a test, + local_temp_file_path=temp_file_name, ) as temp: temp_file_found_when_in_context_manager = pathlib.Path(temp).exists() - raise Exception # Something nasty happens within the context manager + raise Exception # Something nasty happens within the context manager except: - pass # We go with the test, ignoring the forced exception + pass # We go with the test, ignoring the forced exception - temp_file_missing_when_outside_context_manager = not pathlib.Path(temp_file_name).exists() + temp_file_missing_when_outside_context_manager = not pathlib.Path( + temp_file_name + ).exists() - assert temp_file_found_when_in_context_manager and temp_file_missing_when_outside_context_manager \ No newline at end of file + assert ( + temp_file_found_when_in_context_manager + and temp_file_missing_when_outside_context_manager + )