database¶
Scope: function | Returns: LimeDatabase
The database fixture provides the database the test runs against. Each test gets a fresh in-memory SQLite database, so tests cannot interfere with each other. Most other fixtures depend on it, directly or indirectly.
Info
Tables for your limetypes are created lazily, the first time each limetype is accessed — see create_limetype_tables.
Prepopulated data¶
The database comes seeded with:
- Groups
AdministratorsandUsers. They can be accessed through theadministrators_groupandusers_groupfixtures. - User
admin(passwordadmin), member ofAdministrators. This is the userlime_appruns as. - Users
standard(passwordstandard) andstandard_2(passwordstandard_2), members ofUsers. These are the userslime_app_non_adminandlime_app_other_non_adminrun as. en_usas the only active and system language.
Every new user and group created in the database gets an identifier greater than 1000, which reflects the behavior on production.
Basic usage¶
Most tests don't use database directly — they go through higher-level fixtures such as lime_app. Declare it when you need engine-level access:
For a ready-made open connection, use the connection fixture instead.