opensafely-core / job-server

A server for mediating jobs that can be run in an OpenSAFELY secure environment. q.v. job-runner
https://jobs.opensafely.org
Other
5 stars 10 forks source link

[Spike] Test templates that contain forms #4317

Open iaindillingham opened 2 months ago

iaindillingham commented 2 months ago

Several templates contain forms that allow users to update model instances. However, these forms are mostly untested. Consider the following scenario:

A user, who has permission to access the staff area, intends to change a project's status from "Ongoing" to "Retired". The project is associated with the "B" org. The user opens the project edit page, changes the project's status, and clicks "Save". The project's status is "Retired", which is what the user intended. However, because of a bug in the project edit page, the project is associated with the "A" org, which is not what the user intended.

We should test templates that contain forms. However, before we write tests, we should consider:

iaindillingham commented 1 month ago

I'm going to remove this from the board. Whilst we could test templates that contain forms, we could also consider whether there's a deeper issue with how we have modelled the domain. I'm hoping to sketch some ideas, when I've finished reading the Domain Driven Design book.