Skip to content

Commit a559650

Browse files
Mike ProsserMike Prosser
authored andcommitted
fix fake panel servicer to match real behavior better
1 parent 5886f79 commit a559650

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tests/unit/test_panel_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@ def test___open_panels___enumerate_has_panels(fake_panel_channel: grpc.Channel)
1919
assert client.enumerate_panels() == ["panel1", "panel2"]
2020

2121

22-
def test___open_panels___close_panel_1___enumerate_has_panel_2(
22+
def test___open_panels___close_panel_1_with_reset___enumerate_has_panel_2(
2323
fake_panel_channel: grpc.Channel,
2424
) -> None:
2525
client = create_panel_client(fake_panel_channel)
2626
client.open_panel("panel1", "uri1")
2727
client.open_panel("panel2", "uri2")
2828

29-
client.close_panel("panel1", reset=False)
29+
client.close_panel("panel1", reset=True)
3030

3131
assert client.enumerate_panels() == ["panel2"]
3232

3333

34+
def test___open_panels___close_panel_1_without_reset___enumerate_has_both_panels(
35+
fake_panel_channel: grpc.Channel,
36+
) -> None:
37+
client = create_panel_client(fake_panel_channel)
38+
client.open_panel("panel1", "uri1")
39+
client.open_panel("panel2", "uri2")
40+
41+
client.close_panel("panel1", reset=False)
42+
43+
assert client.enumerate_panels() == ["panel1", "panel2"]
44+
45+
3446
def test___get_unset_value_raises_exception(fake_panel_channel: grpc.Channel) -> None:
3547
client = create_panel_client(fake_panel_channel)
3648

tests/utils/_fake_python_panel_servicer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def ClosePanel( # noqa: N802
3737
self, request: ClosePanelRequest, context: Any
3838
) -> ClosePanelResponse:
3939
"""Trivial implementation for testing."""
40-
self._panel_ids.remove(request.panel_id)
4140
if request.reset:
41+
self._panel_ids.remove(request.panel_id)
4242
self._values.clear()
4343
return ClosePanelResponse()
4444

0 commit comments

Comments
 (0)