As part of the OpenAPI work, I realized I wanted to be able to show actual API requests and responses for the documentation. We could generate these manually but doing so would be tedious and would need to be redone every time the API changed. There is a better way: generate these things from the tests. We know that the requests and responses must be correct because we're actually testing against them. It also provides an opportunity to examine our test coverage and fill in gaps, of which there are a few. All of these samples are currently unused but they will be used once we merge in the OpenAPI work.
Note that some of the changes are bigger than we'd like. That's because some tests were actually testing multiple things. This reduced the LoC necessary but meant we didn't have a single request/response to save. Stephen Finucane (13): tests: Add 'store_samples' decorator tests: Add 'store_samples' decorator to 'test_bundle' tests: Add 'store_samples' decorator to 'test_project' tests: Add 'store_samples' decorator to 'test_people' tests: Add 'store_samples' decorator to 'test_user' tests: Add 'store_samples' decorator to 'test_patch' tests: Add 'store_samples' decorator to 'test_cover' tests: Add 'store_samples' decorator to 'test_series' tests: Add 'store_samples' decorator to 'test_comment' tests: Add 'store_samples' decorator to 'test_check' tests: Add tests for '/events' resource tests: Add 'store_samples' decorator to 'test_event' signals: Fix 'series-completed' event .gitignore | 1 + patchwork/signals.py | 21 +++- patchwork/tests/api/test_bundle.py | 76 +++++++++++-- patchwork/tests/api/test_check.py | 54 ++++++--- patchwork/tests/api/test_comment.py | 57 ++++++---- patchwork/tests/api/test_cover.py | 51 ++++++--- patchwork/tests/api/test_event.py | 165 ++++++++++++++++++++++++++++ patchwork/tests/api/test_patch.py | 145 ++++++++++++++++-------- patchwork/tests/api/test_person.py | 37 +++++-- patchwork/tests/api/test_project.py | 110 ++++++++++++++----- patchwork/tests/api/test_series.py | 65 +++++++---- patchwork/tests/api/test_user.py | 65 +++++++++-- patchwork/tests/api/utils.py | 93 ++++++++++++++++ patchwork/tests/test_events.py | 33 +++++- patchwork/tests/utils.py | 10 ++ 15 files changed, 808 insertions(+), 175 deletions(-) create mode 100644 patchwork/tests/api/test_event.py create mode 100644 patchwork/tests/api/utils.py -- 2.17.2 _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
