@@ -98,7 +98,7 @@ async def test_new_dispatch_created(
98
98
generator : DispatchGenerator ,
99
99
) -> None :
100
100
"""Test that a new dispatch is created."""
101
- sample = generator .generate_dispatch (actor_env . microgrid_id )
101
+ sample = generator .generate_dispatch ()
102
102
103
103
await _test_new_dispatch_created (actor_env , sample )
104
104
@@ -134,7 +134,7 @@ async def _test_new_dispatch_created(
134
134
Returns:
135
135
The sample dispatch that was created
136
136
"""
137
- await actor_env .client .create (** to_create_params (sample ))
137
+ await actor_env .client .create (** to_create_params (actor_env . microgrid_id , sample ))
138
138
139
139
dispatch_event = await actor_env .updated_dispatches .receive ()
140
140
@@ -154,7 +154,7 @@ async def test_existing_dispatch_updated(
154
154
fake_time : time_machine .Coordinates ,
155
155
) -> None :
156
156
"""Test that an existing dispatch is updated."""
157
- sample = generator .generate_dispatch (actor_env . microgrid_id )
157
+ sample = generator .generate_dispatch ()
158
158
sample = replace (
159
159
sample ,
160
160
active = False ,
@@ -167,6 +167,7 @@ async def test_existing_dispatch_updated(
167
167
fake_time .shift (timedelta (seconds = 1 ))
168
168
169
169
await actor_env .client .update (
170
+ microgrid_id = actor_env .microgrid_id ,
170
171
dispatch_id = sample .id ,
171
172
new_fields = {
172
173
"active" : True ,
@@ -199,11 +200,13 @@ async def test_existing_dispatch_deleted(
199
200
fake_time : time_machine .Coordinates ,
200
201
) -> None :
201
202
"""Test that an existing dispatch is deleted."""
202
- sample = generator .generate_dispatch (actor_env . microgrid_id )
203
+ sample = generator .generate_dispatch ()
203
204
204
205
sample = await _test_new_dispatch_created (actor_env , sample )
205
206
206
- await actor_env .client .delete (sample .id )
207
+ await actor_env .client .delete (
208
+ microgrid_id = actor_env .microgrid_id , dispatch_id = sample .id
209
+ )
207
210
fake_time .shift (timedelta (seconds = 10 ))
208
211
await asyncio .sleep (10 )
209
212
@@ -223,9 +226,9 @@ async def test_dispatch_schedule(
223
226
fake_time : time_machine .Coordinates ,
224
227
) -> None :
225
228
"""Test that a random dispatch is scheduled correctly."""
226
- sample = generator .generate_dispatch (actor_env . microgrid_id )
227
- await actor_env .client .create (** to_create_params (sample ))
228
- dispatch = Dispatch (actor_env .client .dispatches [0 ])
229
+ sample = generator .generate_dispatch ()
230
+ await actor_env .client .create (** to_create_params (actor_env . microgrid_id , sample ))
231
+ dispatch = Dispatch (actor_env .client .dispatches ( actor_env . microgrid_id ) [0 ])
229
232
230
233
next_run = dispatch .next_run_after (_now ())
231
234
assert next_run is not None
0 commit comments