Test setting the custom admin dashboard of an app. Args: test_get_engine: The default database engine. test_model_auth: The default model for an auth admin dashboard. test_custom_auth_admin: The custom auth provider.
(
test_get_engine: Engine,
test_custom_auth_admin: type[AuthProvider],
test_model_auth: Model,
)
| 409 | reason="starlette_admin not installed or sqlmodel not installed or pydantic not installed", |
| 410 | ) |
| 411 | def test_initialize_with_custom_admin_dashboard( |
| 412 | test_get_engine: Engine, |
| 413 | test_custom_auth_admin: type[AuthProvider], |
| 414 | test_model_auth: Model, |
| 415 | ): |
| 416 | """Test setting the custom admin dashboard of an app. |
| 417 | |
| 418 | Args: |
| 419 | test_get_engine: The default database engine. |
| 420 | test_model_auth: The default model for an auth admin dashboard. |
| 421 | test_custom_auth_admin: The custom auth provider. |
| 422 | """ |
| 423 | from starlette_admin.contrib.sqla.admin import Admin |
| 424 | |
| 425 | custom_auth_provider = test_custom_auth_admin() |
| 426 | custom_admin = Admin(engine=test_get_engine, auth_provider=custom_auth_provider) |
| 427 | app = App(admin_dash=AdminDash(models=[test_model_auth], admin=custom_admin)) |
| 428 | assert app.admin_dash is not None |
| 429 | assert app.admin_dash.admin is not None |
| 430 | assert len(app.admin_dash.models) > 0 |
| 431 | assert app.admin_dash.models[0] == test_model_auth |
| 432 | assert app.admin_dash.admin.auth_provider == custom_auth_provider |
| 433 | |
| 434 | |
| 435 | @pytest.mark.skipif( |
nothing calls this directly
no test coverage detected