Skip to content
Snippets Groups Projects
Commit 8fa5944c authored by Erik Reid's avatar Erik Reid
Browse files

unittest wip

parent 293bdbf5
No related branches found
No related tags found
No related merge requests found
import contextlib
import os
from unittest import mock
from inventory_provider.tasks import monitor
CONNECTION_FINGERPRINT = "SDF@#$@#"
@contextlib.contextmanager
def mocked_connection():
yield CONNECTION_FINGERPRINT
class MockedState():
def __init__(self):
pass
def event(self, e):
pass
class MockedReceiver():
def __init__(self, connection, handlers):
assert connection == CONNECTION_FINGERPRINT
self.handlers = handlers
def capture(self, **kwargs):
pass
@mock.patch('inventory_provider.tasks.monitor.app.events.State', MockedState)
@mock.patch('inventory_provider.tasks.monitor.app.connection', mocked_connection)
def test_latchdb(data_config_filename, mocked_redis):
os.environ['INVENTORY_PROVIDER_CONFIG_FILENAME'] = data_config_filename
monitor.run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment