Test get_from_db and send_to_db
1- Adding tests for get_from_db
and send_to_db
.
2- Adding Exceptions for expected errors (no report_path, no attribute for constant files after fail retrieval)
Description
This MR introduces tests for both functions for retrieving/injecting constants with the database.
Each function has two tests. One for testing the behavior of different arguments without errors, while the other test for the expected raised errors. The former tests are done while mocking (retrieve/send function) and the latter communicates with the database for max-exfl017
How Has This Been Tested?
using pytest locally and on Gitlab
TODO after this MR:
1- get_pdu_from_db needs to be refactored and test karabo_id and karabo_da needs to be added again as it was lost after overwriting test CALCAT with production CALCAT.
2- send_to_db
and get_from_db
require to refactor as they consist of multiple flags as doraise
which can cause nontransparent behavior and some flags should be properly replaced (success in send_to_db).
Relevant Documents (optional)
Types of changes
- Test (additional or refactored tests)
- Bugfix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
Checklist:
- My code follows the code style of this project.
- I added tests where appropriate.