Skip to content

lime_app_non_admin

Scope: function | Returns: LimeApplication

The lime_app_non_admin fixture provides a LimeApplication instance connected to the test database, running as a non-admin user. Use it in tests that need to verify behavior under restricted permissions.

Warning

An error is raised if the user provided by non_admin_user is a member of the Administrators group.

Basic usage

def test_non_admin_can_create_company(lime_app_non_admin, save_lime_objects):
    company = lime_app_non_admin.limetypes.company(name="Acme")

    saved = save_lime_objects(company)

    assert saved.id is not None

Extending the fixture

Override lime_app_non_admin in your conftest.py to run additional setup after the application is ready. pytest resolves the lime_app_non_admin parameter to the definition from lime_test, so the override can build on top of it:

@pytest.fixture
def lime_app_non_admin(lime_app_non_admin, save_lime_objects):
    coworker = lime_app_non_admin.limetypes.coworker(firstname="Standard", lastname="User")
    save_lime_objects(coworker, application=lime_app_non_admin)
    return lime_app_non_admin

Configurable dependencies

Fixture Controls Default
lime_app_non_admin_acl Access control layer AlwaysAllowAcl — all operations permitted
non_admin_user The user the application runs as User with username standard fetched from the database
lime_db_app_config Application configuration Empty AppConfig