コード例 #1
0
 def test_list_params(self):
     change = CreateOfferChange(1, [], params=["application", "endpoints", "offer_name"])
     self.assertEqual({"change_id": 1,
                       "requires": [],
                       "application": "application",
                       "endpoints": "endpoints",
                       "offer_name": "offer_name"}, change.__dict__)
コード例 #2
0
 def test_dict_params_missing_data(self):
     change = CreateOfferChange(1, [], params={"application": "application",
                                               "endpoints": "endpoints"})
     self.assertEqual({"change_id": 1,
                       "requires": [],
                       "application": "application",
                       "endpoints": "endpoints",
                       "offer_name": None}, change.__dict__)
コード例 #3
0
    async def test_run(self, event_loop):
        change = CreateOfferChange(1, [], params={"application": "application",
                                                  "endpoints": ["endpoints"],
                                                  "offer-name": "offer_name"})

        model = mock.Mock()
        model.create_offer = base.AsyncMock(return_value=None)

        context = mock.Mock()
        context.resolve = mock.Mock(side_effect=['application1'])
        context.model = model

        result = await change.run(context)
        assert result is None

        model.create_offer.assert_called_once()
        model.create_offer.assert_called_with("endpoints",
                                              offer_name="offer_name",
                                              application_name="application1")
コード例 #4
0
 def test_method(self):
     self.assertEqual("createOffer", CreateOfferChange.method())