Test formatting
This commit is contained in:
parent
f75b832903
commit
dd07cd7959
1 changed files with 21 additions and 10 deletions
|
|
@ -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
|
||||
assert (
|
||||
temp_file_found_when_in_context_manager
|
||||
and temp_file_missing_when_outside_context_manager
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue