Phester needs a way to act as different users, to test capabilities of
users with different privileges, as well as testing interactions
betweren multiple users. It make this convenient and performant,
it should be easy for users to be created and logged in in a fixture,
with the resultign session being available for re-use in tests.
For now, a "session context" will provide an opaque cookie jar.
Other things, like variables, can be added to it later.
Some key ideas:
- a session context contains all the cookies set in responses, and sends them out in requests.
- contexts used by fixtures become available to tests under the name of the fixture. A test that declares a dependency on fixture "Foo" can use that fixture's context, and can refer to it by the name "Foo".
- there is one default session context associated with each interaction (one for each test, one for a suit's setup, one for a fixture). The suite's "local" context is the one associated with the suite's setup interaction.
- a context can be imported (cloned) by name for use in an interaction. Test that do not specify which context to use will use a (clone of) the suite's context.
- individual requests can again use a different context, referenced by name.
- All requests in one test share the same context objects - that is, two requests in one test using the context Foo would "see" changes the other makes to that context, while requests in another test that also use the context Foo would not.
- configuration variables can be accessed through a special context called "config".