@@ -79,10 +79,10 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
7979 ]
8080 },
8181 1 ,
82- "1 dispatches total. " ,
82+ "1 dispatches, 0 filtered out " ,
8383 0 ,
8484 ),
85- ({}, 1 , "0 dispatches total. " , 0 ),
85+ ({}, 1 , "0 dispatches, 0 filtered out " , 0 ),
8686 (
8787 {
8888 2 : [
@@ -102,7 +102,7 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
102102 ]
103103 },
104104 1 ,
105- "0 dispatches total. " ,
105+ "0 dispatches, 0 filtered out " ,
106106 0 ,
107107 ),
108108 (
@@ -139,7 +139,7 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
139139 ],
140140 },
141141 1 ,
142- "1 dispatches total. " ,
142+ "1 dispatches, 0 filtered out " ,
143143 0 ,
144144 ),
145145 (
@@ -148,6 +148,41 @@ def mock_client(fake_client: FakeClient) -> Generator[None, None, None]:
148148 "Error: Invalid value for 'MICROGRID_ID': 'x' is not a valid integer." ,
149149 2 ,
150150 ),
151+ (
152+ {
153+ 1 : [
154+ Dispatch (
155+ id = 1 ,
156+ type = "test" ,
157+ start_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
158+ duration = timedelta (seconds = 3600 ),
159+ target = [1 , 2 , 3 ],
160+ active = True ,
161+ dry_run = False ,
162+ payload = {},
163+ recurrence = RecurrenceRule (),
164+ create_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
165+ update_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
166+ ),
167+ Dispatch (
168+ id = 2 ,
169+ type = "filtered" ,
170+ start_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
171+ duration = timedelta (seconds = 1800 ),
172+ target = [3 ],
173+ active = True ,
174+ dry_run = False ,
175+ payload = {},
176+ recurrence = RecurrenceRule (),
177+ create_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
178+ update_time = datetime (2023 , 1 , 1 , 0 , 0 , 0 ),
179+ ),
180+ ],
181+ },
182+ 1 ,
183+ "1 dispatches, 1 filtered out" ,
184+ 0 ,
185+ ),
151186 ],
152187)
153188async def test_list_command (
@@ -163,7 +198,9 @@ async def test_list_command(
163198 fake_client .set_dispatches (microgrid_id_ , dispatch_list )
164199
165200 result = await runner .invoke (
166- cli , ["--raw" , "list" , str (microgrid_id )], env = ENVIRONMENT_VARIABLES
201+ cli ,
202+ ["--raw" , "list" , str (microgrid_id ), "--type" , "test" ],
203+ env = ENVIRONMENT_VARIABLES ,
167204 )
168205 assert expected_output in result .output
169206 assert result .exit_code == expected_return_code
0 commit comments