opensafely-core / airlock

Other
1 stars 0 forks source link

Refactor factories to use BLL for all state manipulation, rather than the DAL. #556

Closed bloodearnest closed 1 month ago

bloodearnest commented 1 month ago

In a few places, we use the DAL directly from the test factories to manipulate state. This is convenient, but has two drawbacks:

1) It potentially allows invalid states to be created 2) It requires duplicating some logic, particularly the creation of event logs.

This change moves to using only BLL methods to manipulate state. This requires us to respect some limitations that previously we had ignored. Most of that is handled in the test factories, but in one case a test needed a fair bit more setup to get into the right state.

Note that we still use the dal in a couple of places in the test factories, for creating filegroups and audit events directly. However, the former is very simple, and the latter has no BLL equivalent.