Esempio n. 1
0
 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), )
Esempio n. 2
0
    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}),
        )
Esempio n. 3
0
    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),
        )
Esempio n. 4
0
    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