generated from MITLibraries/python-cli-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Config module to current conventions
Why these changes are being introduced: * Use a central Config class for dynamic access to environment variables and simplify method for configuring loggers. How this addresses that need: * Create a Config class for dynamically accessing environment variables * Deprecate load_alma_config and update AlmaClient to use Config class to dynamically set attributes (base_url, headers, timeout) * Update configure_logger to use 'verbose' boolean flag * Update CLI to accept '-v/--verbose' boolean option and remove '-l/--log-level' string option * Add/update corresponding unit tests Side effects of this change: * Remove LOG_LEVEL as an optional environment variable Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-1065
- Loading branch information
1 parent
da3d1d9
commit bb3bd47
Showing
7 changed files
with
101 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,16 +30,15 @@ def test_cli_all_options_passed(caplog, runner): | |
"[email protected]", | ||
"--date", | ||
"2023-01-02", | ||
"--log-level", | ||
"debug", | ||
"--verbose", | ||
], | ||
) | ||
assert result.exit_code == 0 | ||
assert "Logger 'root' configured with level=DEBUG" in caplog.text | ||
assert ( | ||
"Command called with options: {'source_email': '[email protected]', " | ||
"'recipient_email': ('[email protected]', '[email protected]'), " | ||
"'date': '2023-01-02', 'log_level': 'debug'}" in caplog.text | ||
"'date': '2023-01-02', 'verbose': True}" in caplog.text | ||
) | ||
assert ( | ||
"Credit card slips processing complete for date 2023-01-02. Email sent to " | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters