Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Issue: #15
Implementation:
test_config.py
. This file will contain all the tests for the functions inconfig.py
. Use theunittest
module to structure your tests. Start by importing the necessary modules and creating a new test case class.test_config.py
file, create a test for thefetch_config
function. Use theunittest.mock
module to create a mock Google Cloud Storage bucket and blob. Test that the function correctly fetches the blob and returns the updated time. Also, test the case where the blob does not exist and the function should return None.test_config.py
file, create a test for theget_module_filepath
function. Create a mock file and test that the function correctly returns the full file path of the mock file. Also, test the case where the file does not exist and the function should raise an error.test_config.py
file, create a test for theload_config
function. Create a mock configuration file and test that the function correctly loads the file. Also, test the case where the file does not exist and the function should raise an error. Additionally, test the case where the environment variable is not set and the function should raise an error.test_config.py
file, create a test for theload_config_key
function. Create a mock configuration file and test that the function correctly loads a specific key from the file. Also, test the case where the key does not exist in the configuration file and the function should raise an error.Report:
Create a new test file for config.py
Created a new test file 'test_config.py' in the '/sunholo/tests/' directory. The file currently imports the necessary modules and has a test case class named 'TestConfig'.Create tests for fetch_config function
Added a test for thefetch_config
function in thetest_config.py
file. The test uses mock objects to simulate a Google Cloud Storage bucket and blob, and tests that the function correctly fetches the blob and returns the updated time. It also tests the case where the blob does not exist and the function should return None.Create tests for get_module_filepath function
Added a test for theget_module_filepath
function in thetest_config.py
file. The test uses a mock file and tests that the function correctly returns the full file path of the mock file. It also tests the case where the file does not exist and the function should raise an error.Create tests for load_config function
Added a test for theload_config
function in thetest_config.py
file. The test uses a mock configuration file and tests that the function correctly loads the file. It also tests the cases where the file does not exist and the environment variable is not set.Create tests for load_config_key function
Added a test for theload_config_key
function in thetest_config.py
file. The test uses a mock configuration file and tests that the function correctly loads a specific key from the file. It also tests the case where the key does not exist in the configuration file and the function should raise an error.Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #15. Then, add the
ellipsis:create
label to try again. For more information, check the documentation.