Skip to content

Commit d5aa4a7

Browse files
claudiolorddutt
authored andcommitted
Fix poller/controller tests not using dummy cfg file
Signed-off-by: Claudio Lorina <[email protected]>
1 parent d186a34 commit d5aa4a7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/unit/poller/controller/test_controller.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from suzieq.poller.controller.source.native import SqNativeFile
1515
from suzieq.poller.controller.source.netbox import Netbox
1616
from suzieq.shared.exceptions import InventorySourceError, SqPollerConfError
17-
from suzieq.shared.utils import load_sq_config, sq_get_config_file
17+
from suzieq.shared.utils import load_sq_config
1818
from tests.conftest import create_dummy_config_file, get_async_task_mock
1919

2020
# pylint: disable=protected-access
@@ -184,7 +184,7 @@
184184

185185

186186
def generate_controller(args: Dict, inv_file: str = None,
187-
conf_file: str = '') -> Controller:
187+
conf_file: str = None) -> Controller:
188188
"""Generate a Controller object
189189
190190
Args:
@@ -195,7 +195,7 @@ def generate_controller(args: Dict, inv_file: str = None,
195195
Returns:
196196
Controller: the newly created Controller
197197
"""
198-
if conf_file == '':
198+
if not conf_file:
199199
conf_file = create_dummy_config_file()
200200
config = load_sq_config(config_file=conf_file)
201201
args = update_args(args, inv_file, conf_file)
@@ -401,7 +401,7 @@ def test_missing_default_inventory(default_args):
401401
with patch.multiple(controller_module,
402402
DEFAULT_INVENTORY_PATH='/not/a/path'):
403403
with pytest.raises(SqPollerConfError):
404-
generate_controller(args=args, conf_file=None)
404+
generate_controller(args=args)
405405

406406

407407
@pytest.mark.poller
@@ -416,11 +416,10 @@ def test_default_controller_config(default_args):
416416
with NamedTemporaryFile(suffix='yml') as tmpfile:
417417
with patch.multiple(controller_module,
418418
DEFAULT_INVENTORY_PATH=tmpfile.name):
419-
c = generate_controller(args=args, conf_file=None)
419+
c = generate_controller(args=args)
420420
assert c._config['source']['path'] == tmpfile.name
421421
assert c._input_dir is None
422422
assert c._no_coalescer is False
423-
assert c._config['manager']['config'] == sq_get_config_file(None)
424423
assert c._config['manager']['workers'] == 1
425424
assert c.period == 3600
426425
assert c._single_run_mode is None

0 commit comments

Comments
 (0)