Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inadvertent pytest fixture session token usage
This commit will correct the two failing tests: ```text FAILED tests/cloud/test_object_storage.py::TestObjectStorageClientUnit:: test_generate_presigned_url_example[False] FAILED tests/cloud/test_object_storage.py::TestObjectStorageClientUnit:: test_generate_presigned_post_example[False] ``` The `False` parameter output means that `use_session_token` was `False` in the corresponding fixtures in conftest.py: - `object_storage_config_for_presigned_url_example` - `object_storage_config_for_presigned_post_example` There may be situations, such as tests in a GitHub Actions workflow, in which multiple sets of credentials are present. In these situations, there may be environment variables such as `AWS_SESSION_TOKEN` that are set, but should not be used in certain `ObjectStorageConfig` instances. Setting `session_token` to an empty string (`session_token=""`) prevents `class ObjectStorageConfig` from using the environment variable value. There is a unit test, `test_config_with_environment_variable_overrides` in `tests/cloud/test_object_storage.py`, which verifies the correct behavior. However, the pytest fixtures listed above were still setting `session_token=None`, which then was making their `ObjectStorageConfig` instances inadvertently pick up `AWS_SESSION_TOKEN`. The fix is just to set `session_token=""` when `use_session_token=False` in those fixtures.
- Loading branch information