diff --git a/awx/main/tests/factories/README.md b/awx/main/tests/factories/README.md index 8b864d0708..c451c02598 100644 --- a/awx/main/tests/factories/README.md +++ b/awx/main/tests/factories/README.md @@ -47,3 +47,19 @@ examples objects = create_organization('test-org', persisted=False) assert not objects.organization.pk + +patterns +-------- + +`mk` functions are single object fixtures. They should create only a single object with the minimum deps. +They should also accept a `persited` flag, if they must be persisted to work, they raise an error if persisted=False + +`generate` and `apply` functions are helpers that build up the various parts of a `create` functions objects. These +should be useful for more than one create function to use and should explicitly accept all of the values needed +to execute. These functions should also be robust and have very speciifc error reporting about constraints and/or +bad values. + +`create` functions compose many of the `mk` and `generate` functions to make different object +factories. These functions when giving the minimum set of arguments should only produce a +single artifact (or the minimum needed for that object). These should be wrapped by discoverable +fixtures in various conftest.py files.