File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,6 +295,11 @@ def get_plan(self, name: str) -> PlanModel:
295295 """
296296 return self ._rest .get_plan (name )
297297
298+ def show_plans (self ) -> None :
299+ """Command to print all avaliable plans."""
300+ for name in self .plans :
301+ print (name )
302+
298303 @start_as_current_span (TRACER )
299304 @deprecated ("devices property" )
300305 def get_devices (self ) -> DeviceResponse :
@@ -334,6 +339,11 @@ def get_device(self, name: str) -> DeviceModel:
334339
335340 return self ._rest .get_device (name )
336341
342+ def show_devices (self ) -> None :
343+ """Command to print all avaliable devices."""
344+ for name in self .devices :
345+ print (name )
346+
337347 @property
338348 @start_as_current_span (TRACER )
339349 def state (self ) -> WorkerState :
Original file line number Diff line number Diff line change @@ -145,6 +145,13 @@ def test_get_plan(client: BlueapiClient):
145145 assert client .plans ["foo" ].model == PLAN
146146
147147
148+ def test_show_plans (client : BlueapiClient , capsys : pytest .CaptureFixture ):
149+ client .show_plans ()
150+ captured = capsys .readouterr ()
151+ for dev in PLANS .plans :
152+ assert dev .name in captured .out
153+
154+
148155def test_get_nonexistant_plan (
149156 client : BlueapiClient ,
150157):
@@ -160,6 +167,13 @@ def test_get_device(client: BlueapiClient):
160167 assert client .devices .foo .model == DEVICE
161168
162169
170+ def test_show_devices (client : BlueapiClient , capsys : pytest .CaptureFixture ):
171+ client .show_devices ()
172+ captured = capsys .readouterr ()
173+ for dev in DEVICES .devices :
174+ assert dev .name in captured .out
175+
176+
163177def test_get_nonexistent_device (
164178 client : BlueapiClient ,
165179):
You can’t perform that action at this time.
0 commit comments