@@ -236,6 +236,57 @@ async def test_run_local(self, event_loop):
236236 devices = "devices" ,
237237 num_units = "num_units" )
238238
239+ @pytest .mark .asyncio
240+ async def test_run_no_series (self , event_loop ):
241+ change = AddApplicationChange (1 , [], params = {"charm" : "charm" ,
242+ "series" : "" ,
243+ "application" : "application" ,
244+ "options" : "options" ,
245+ "constraints" : "constraints" ,
246+ "storage" : "storage" ,
247+ "endpoint-bindings" : "endpoint_bindings" ,
248+ "resources" : "resources" ,
249+ "devices" : "devices" ,
250+ "num-units" : "num_units" })
251+
252+ model = mock .Mock ()
253+ model ._deploy = base .AsyncMock (return_value = None )
254+ model ._add_store_resources = base .AsyncMock (return_value = ["resource1" ])
255+ model .applications = {}
256+
257+ context = mock .Mock ()
258+ context .resolve .return_value = "charm1"
259+ context .trusted = False
260+ context .model = model
261+ context .bundle = {"bundle" : "kubernetes" }
262+
263+ result = await change .run (context )
264+ assert result == "application"
265+
266+ model ._add_store_resources .assert_called_once ()
267+ model ._add_store_resources .assert_called_with ("application" ,
268+ "charm1" ,
269+ overrides = "resources" )
270+
271+ model ._deploy .assert_called_once ()
272+ model ._deploy .assert_called_with (charm_url = "charm1" ,
273+ application = "application" ,
274+ series = "kubernetes" ,
275+ config = "options" ,
276+ constraints = "constraints" ,
277+ endpoint_bindings = "endpoint_bindings" ,
278+ resources = ["resource1" ],
279+ storage = "storage" ,
280+ devices = "devices" ,
281+ num_units = "num_units" )
282+
283+ # confirm that it's idempotent
284+ model .applications = {"application" : None }
285+ result = await change .run (context )
286+ assert result == "application"
287+ model ._add_store_resources .assert_called_once ()
288+ model ._deploy .assert_called_once ()
289+
239290
240291class TestAddCharmChange (unittest .TestCase ):
241292
0 commit comments