toaster/tests/functional: Improve project creation tests
Quoted 12 lines · Richard Purdie via lists.openembedded.org
Mixing database access and access via a running server is fraught with danger and problems. The "
django_db" marker means the transactions are dropped at the end of the test but the transactions made via the webapi remain so the database ends up confused at best.Drop the database accesses and use the server API. This means slightly abusing the typeahead to get lists of projects in the database.
Add code to delete a project if it already exists. This allows tests to re-run against an existing database. Deletion is done using the server API but this means handling CSRF tokens.
Quoted 8 lines
Add requests module requirement to requirements file since the project creation code now uses requests.
Signed-off-by Richard Purdie <[email protected]>---
.../functional/test_create_new_project.py | 28 +++++++++++++------ .../tests/toaster-tests-requirements.txt | 2 ++2 files changed, 22 insertions(+), 8 deletions(-)
This was meant to be at the start of that 28 patch series, sorry. I had an off by 1 error when sending. I decided not to spam the list with the whole thing again...
Cheers,
Richard