Skip to contentSkip to conversation

toaster/tests/functional: Improve project creation tests

PATCH Richard Purdie 1 participant 1 message Oct 23, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
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.

---
 .../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