Example #1
0
 def test_dict_params(self):
     change = ConsumeOfferChange(1, [], params={"url": "url",
                                                "application-name": "application_name"})
     self.assertEqual({"change_id": 1,
                       "requires": [],
                       "url": "url",
                       "application_name": "application_name"}, change.__dict__)
Example #2
0
    async def test_run(self, event_loop):
        change = ConsumeOfferChange(1, [], params={"url": "url",
                                                   "application-name": "application_name"})

        model = mock.Mock()
        model.consume = 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.consume.assert_called_once()
        model.consume.assert_called_with("url",
                                         application_alias="application1")
Example #3
0
 def test_method(self):
     self.assertEqual("consumeOffer", ConsumeOfferChange.method())