Beispiel #1
0
 def test_dict_params(self):
     change = AddUnitChange(1, [], params={"application": "application",
                                           "to": "to"})
     self.assertEqual({"change_id": 1,
                       "requires": [],
                       "application": "application",
                       "to": "to"}, change.__dict__)
Beispiel #2
0
    async def test_run(self, event_loop):
        change = AddUnitChange(1, [], params={"application": "application",
                                              "to": "to"})

        app = mock.Mock()
        app.add_unit = base.AsyncMock(return_value="unit1")

        model = MockModel({"application1": app})

        context = mock.Mock()
        context.resolve = mock.Mock(side_effect=['application1', 'to1'])
        context._units_by_app = {}
        context.model = model

        result = await change.run(context)
        assert result == "unit1"

        model.applications["application1"].add_unit.assert_called_once()
        model.applications["application1"].add_unit.assert_called_with(count=1, to="to1")
Beispiel #3
0
 def test_method(self):
     self.assertEqual("addUnit", AddUnitChange.method())