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.
Added following unit tests to validate newsletter db
Context of the work
Firstly , I tried using sqlalchemy's metadata to verify table schemas . It did not fit because unit test assertion fails to validate schema objects .Unittests assertion validates object references instead of values and Fails .
Next solution is to try sqlalchemy's inspect which worked with some work around and here also list assertion Fails at type comparision [{'type':INTEGER}] , so I converted list to string for assertion to work as it is expected
Note: test_db has been binded and created to store expected db models to compare with actual newsletter db models , I chose to create test_db instead of storing expected db objects into variables as I thought its easy to read and maintain test_db for any updates required in the future