def test_invalid_version(self, version): with pytest.raises(ValueError) as e: indexing.IndexableMessage.wrap( kombu.Message( content_type='application/json', body=json.dumps({'version': version}), )) assert e.value.args == ('Invalid version "{}"'.format(version), )
def message_factory(self, model='CreativeWork', ids=None): if ids is None: ids = [1, 2, 3] return kombu.Message( content_type='application/json', body=json.dumps({model: ids}), )
def message(self, request): version, model, ids, payload = request.param self.EXPECTED_IDS = ids self.EXPECTED_MODEL = model self.EXPECTED_VERSION = version return kombu.Message( content_type='application/json', body=json.dumps(payload), )
def message_factory(self, model='CreativeWork', ids=None): if ids is None: ids = [1, 2, 3] msg = indexing.IndexableMessage.wrap( kombu.Message( content_type='application/json', body=json.dumps({model: ids}), )) msg.message.ack = mock.Mock() msg.message.requeue = mock.Mock() return msg