@@ -377,12 +377,17 @@ def test_add_duplicate_page_route_error(app: App, first_page, second_page, route
377377 or not find_spec ("pydantic" ),
378378 reason = "starlette_admin not installed or sqlmodel not installed or pydantic not installed" ,
379379)
380- def test_initialize_with_admin_dashboard (test_model : Model ):
380+ def test_initialize_with_admin_dashboard (
381+ test_model : type [Model ], mocker : MockerFixture
382+ ):
381383 """Test setting the admin dashboard of an app.
382384
383385 Args:
384386 test_model: The default model.
387+ mocker: pytest mocker object.
385388 """
389+ conf = rx .Config (app_name = "testing" , db_url = "sqlite:///reflex.db" )
390+ mocker .patch ("reflex_base.config._get_config" , return_value = conf )
386391 app = App (admin_dash = AdminDash (models = [test_model ]))
387392 assert app .admin_dash is not None
388393 assert len (app .admin_dash .models ) > 0
@@ -425,17 +430,23 @@ def test_initialize_with_custom_admin_dashboard(
425430 or not find_spec ("pydantic" ),
426431 reason = "starlette_admin not installed or sqlmodel not installed or pydantic not installed" ,
427432)
428- def test_initialize_admin_dashboard_with_view_overrides (test_model ):
433+ def test_initialize_admin_dashboard_with_view_overrides (
434+ test_model : type [Model ], mocker : MockerFixture
435+ ):
429436 """Test setting the admin dashboard of an app with view class overridden.
430437
431438 Args:
432439 test_model: The default model.
440+ mocker: pytest mocker object.
433441 """
434442 from starlette_admin .contrib .sqla .view import ModelView
435443
436444 class TestModelView (ModelView ):
437445 pass
438446
447+ conf = rx .Config (app_name = "testing" , db_url = "sqlite:///reflex.db" )
448+ mocker .patch ("reflex_base.config._get_config" , return_value = conf )
449+
439450 app = App (
440451 admin_dash = AdminDash (
441452 models = [test_model ], view_overrides = {test_model : TestModelView }
0 commit comments