Skip to content

Utils

Offers various utility fixtures.

Functions

conf_app_name

conf_app_name() -> str

Returns your application name (deduced or provided).


get_stamp

get_stamp() -> str

Returns current timestamp as a string.


registered_urls

registered_urls() -> dict

Returns mapping from registered urlpatterns to names and args.

def test_me(registered_urls):
    assert 'admin:testapp_article_change object_id' in f'{registered_urls}'

run_app

run_app(command_run, user_create, capsys, settings)

Issues runserver command using current configuration (dynamic or defined by user through configure_djangoapp_plugin()).

Useful for manual verification and debug, to have look and feel of an enduser project with your app.

Run the test using the fixture as usual. It'll start Django development server. Stop server with Ctrl+C.

Admin user is automatically created: username=admin password=admin

1
2
3
def test_me(run_app):
    ...
    run_app()