Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Antony Milne <[email protected]>
Signed-off-by: Ann Marie Ward <[email protected]>
  • Loading branch information
AnnMarieW and antonymilne authored Dec 20, 2023
1 parent b3dcce9 commit e035ecf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions vizro-core/tests/unit/vizro/models/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,20 @@ def test_page_registry_with_description(self, vizro_app, mocker):
"image_path", ["app.png", "app.svg", "images/app.png", "images/app.svg", "logo.png", "logo.svg"]
)
def test_page_registry_with_image(self, page_1, mocker, tmp_path, image_filename):
Path(tmp_path / "folder").mkdir()
if image_path.parent != Path("."):
Path(tmp_path / image_path.parent).mkdir()
Path(tmp_path / image_filename).touch()
vizro.Vizro(assets_folder=tmp_path)
# at top of file: from vizro import Vizro
Vizro(assets_folder=tmp_path)
mock_register_page = mocker.patch("dash.register_page", autospec=True)
vm.Dashboard(pages=[page_1], title="My dashboard").pre_build()
vm.Dashboard(pages=[page_1]).pre_build()

mock_register_page.assert_any_call(
module=page_1.id,
name="Page 1",
description="",
image=image_filename,
title="My dashboard: Page 1",
title="Page 1",
path="/",
order=0,
layout=mocker.ANY, # partial call is tricky to mock out so we ignore it.
Expand All @@ -158,7 +160,7 @@ def test_page_registry_with_images(self, page_1, mocker, tmp_path):
Path(tmp_path / "logo.svg").touch()
vizro.Vizro(assets_folder=tmp_path)
mock_register_page = mocker.patch("dash.register_page", autospec=True)
vm.Dashboard(pages=[page_1], title="My dashboard").pre_build()
vm.Dashboard(pages=[page_1]).pre_build()

mock_register_page.assert_any_call(
module=page_1.id,
Expand Down

0 comments on commit e035ecf

Please sign in to comment.