async def test_run(self, event_loop): change = AddCharmChange(1, [], params={ "charm": "charm", "series": "series", "channel": "channel" }) charmstore = mock.Mock() charmstore.entityId = base.AsyncMock(return_value="entity_id") client_facade = mock.Mock() client_facade.AddCharm = base.AsyncMock(return_value=None) context = mock.Mock() context.charmstore = charmstore context.client_facade = client_facade result = await change.run(context) assert result == "entity_id" charmstore.entityId.assert_called_once() charmstore.entityId.assert_called_with("charm", channel="channel") client_facade.AddCharm.assert_called_once() client_facade.AddCharm.assert_called_with(channel="channel", url="entity_id", force=False)
def test_list_params_juju_2_6(self): change = AddCharmChange(1, [], params=["charm", "series"]) self.assertEqual({"change_id": 1, "requires": [], "charm": "charm", "series": "series", "channel": None}, change.__dict__)
def test_dict_params_missing_data(self): change = AddCharmChange(1, [], params={"charm": "charm", "series": "series"}) self.assertEqual({"change_id": 1, "requires": [], "charm": "charm", "series": "series", "channel": None}, change.__dict__)
def test_dict_params(self): change = AddCharmChange(1, [], params={ "charm": "charm", "series": "series", "channel": "channel", "architecture": "architecture" }) self.assertEqual( { "change_id": 1, "requires": [], "charm": "charm", "series": "series", "channel": "channel", "architecture": "architecture" }, change.__dict__)
def test_method(self): self.assertEqual("addCharm", AddCharmChange.method())