Beispiel #1
0
import pytest
import mock
import requests

import resultsdbupdater.utils

from resultsdbupdater import consumer as ciconsumer


class FakeHub(object):
    config = {}


json_dir = path.join(path.abspath(path.dirname(__file__)), 'fake_messages')
consumer = ciconsumer.CIConsumer(FakeHub())
uuid_patcher = mock.patch('resultsdbupdater.utils.uuid.uuid4',
                          return_value='1bb0a6a5-3287-4321-9dc5-72258a302a37')
uuid_patcher.start()


@pytest.fixture
def mock_session():
    with mock.patch('resultsdbupdater.utils.retry_session') as mocked:
        yield mocked()


def get_fake_msg(name):
    fake_msg_path = path.join(json_dir, name + '.json')
    with open(fake_msg_path) as fake_msg_file:
        return json.load(fake_msg_file)
 def setUp(self):
     self.cassettes_dir = path.join(path.abspath(path.dirname(__file__)),
                                    'cassettes')
     self.json_dir = path.join(path.abspath(path.dirname(__file__)),
                               'fake_messages')
     self.consumer = ciconsumer.CIConsumer(FakeHub())