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

pep8

parent e3555d3a
Branches
Tags 0.45
No related merge requests found
...@@ -66,6 +66,7 @@ TASK_LOG_SCHEMA = { ...@@ -66,6 +66,7 @@ TASK_LOG_SCHEMA = {
'additionalProperties': False 'additionalProperties': False
} }
def get_latch(r): def get_latch(r):
latch = r.get('db:latch') latch = r.get('db:latch')
if latch is None: if latch is None:
......
...@@ -111,7 +111,8 @@ def snmp_refresh_interfaces(self, hostname, community): ...@@ -111,7 +111,8 @@ def snmp_refresh_interfaces(self, hostname, community):
def netconf_refresh_config(self, hostname): def netconf_refresh_config(self, hostname):
try: try:
netconf_doc = juniper.load_config(hostname, InventoryTask.config["ssh"]) netconf_doc = juniper.load_config(
hostname, InventoryTask.config["ssh"])
netconf_str = etree.tostring(netconf_doc, encoding='unicode') netconf_str = etree.tostring(netconf_doc, encoding='unicode')
except ConnectionError: except ConnectionError:
msg = f'error loading netconf data from {hostname}' msg = f'error loading netconf data from {hostname}'
......
...@@ -21,6 +21,7 @@ TEST_LOG_EVENTS = [ ...@@ -21,6 +21,7 @@ TEST_LOG_EVENTS = [
{'type': 'task-error', 'uuid': 'AAAA', 'clock': 777} {'type': 'task-error', 'uuid': 'AAAA', 'clock': 777}
] ]
@contextlib.contextmanager @contextlib.contextmanager
def mocked_connection(): def mocked_connection():
yield CONNECTION_FINGERPRINT yield CONNECTION_FINGERPRINT
...@@ -56,8 +57,10 @@ def backend_db(): ...@@ -56,8 +57,10 @@ def backend_db():
@mock.patch('inventory_provider.tasks.monitor.app.events.State', MockedState) @mock.patch('inventory_provider.tasks.monitor.app.events.State', MockedState)
@mock.patch('inventory_provider.tasks.monitor.app.connection', mocked_connection) @mock.patch(
@mock.patch('inventory_provider.tasks.monitor.app.events.Receiver', MockedReceiver) 'inventory_provider.tasks.monitor.app.connection', mocked_connection)
@mock.patch(
'inventory_provider.tasks.monitor.app.events.Receiver', MockedReceiver)
def test_latchdb(data_config_filename, mocked_redis): def test_latchdb(data_config_filename, mocked_redis):
os.environ['INVENTORY_PROVIDER_CONFIG_FILENAME'] = data_config_filename os.environ['INVENTORY_PROVIDER_CONFIG_FILENAME'] = data_config_filename
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment