Skip to content

Commit

Permalink
chore: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ajasnosz committed Apr 10, 2024
1 parent c5ad5f7 commit 5b1a192
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion splunk_connect_for_snmp/common/inventory_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,5 @@ def return_walk_profile(self, runtime_profiles, inventory_profiles):
# if there's more than one walk profile, we're choosing the last one on the list
walk_profile = walk_profiles[-1]
if not walk_profile:
walk_profile = 'WalkProfile'
walk_profile = "WalkProfile"
return walk_profile
8 changes: 2 additions & 6 deletions splunk_connect_for_snmp/inventory/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,8 @@ def load():
new_groups = groups_manager.return_collection()

inventory_ui_collection = mongo_client.sc4snmp.inventory_ui
inventory_processor = InventoryProcessor(
groups_manager, inventory_ui_collection
)
inventory_record_manager = InventoryRecordManager(
mongo_client, periodic_obj
)
inventory_processor = InventoryProcessor(groups_manager, inventory_ui_collection)
inventory_record_manager = InventoryRecordManager(mongo_client, periodic_obj)
if CONFIG_FROM_MONGO:
logger.info(f"Loading inventory from inventory_ui collection")
else:
Expand Down
11 changes: 10 additions & 1 deletion test/common/test_inventory_processor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import logging
import pytest
import os
from unittest import TestCase, mock
from unittest.mock import Mock, mock_open, patch

from _pytest.logging import caplog

from splunk_connect_for_snmp.common.inventory_processor import (
InventoryProcessor,
InventoryRecordManager,
Expand All @@ -18,7 +22,8 @@
0.0.0.0,,2c,public,,,1805,solo_profile1,False,False
0.0.0.0,1161,2c,public,,,1805,solo_profile2,False,False"""


#TODO: write new test for walkProfile and full walk with flag
@pytest.mark.usefixtures("caplog")
class TestInventoryProcessor(TestCase):
profiles = {
"test5": {"frequency": 6, "varBinds": [["IP-MIB"]]},
Expand Down Expand Up @@ -224,6 +229,10 @@ def test_get_group_hosts(self):
inventory_processor.inventory_records, group_object_returned
)

# @mock.patch(
# "splunk_connect_for_snmp.common.inventory_processor.ENABLE_FULL_WALK",
# True,
# )
def test_get_group_hosts_hostname(self):
group_manager = Mock()
logger = Mock()
Expand Down

0 comments on commit 5b1a192

Please sign in to comment.