February 2022
Intermediate to advanced
274 pages
6h 28m
English
Our initial Cards testing strategy statement, “Test the CLI enough to verify the API is getting properly called for all features,” can be taken literally as checking the API calls, as we did with mocks. However, we can satisfy this statement in other ways.
While testing the CLI, we could also use the API. We won’t be testing the API, but using it to check the behavior of actions made through the CLI. Let’s look at an example:
| | def test_add_with_owner(cards_db): |
| | """ |
| | A card shows up in the list with expected contents. |
| | """ |
| | cards_cli("add some task -o brian") |
| | expected = cards.Card("some task", owner="brian", state="todo") |
| | all_cards = cards_db.list_cards() ... |
Read now
Unlock full access