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

parameterized router hostnames

parent a50dc31e
No related branches found
No related tags found
No related merge requests found
......@@ -111,13 +111,17 @@ def data_config_filename(tmp_dir_name):
return filename
@pytest.fixture
def data_config():
def _tmp_data_config():
with tempfile.TemporaryDirectory() as tmpdir:
with open(data_config_filename(tmpdir)) as f:
return config.load(f)
@pytest.fixture
def data_config():
return _tmp_data_config()
@pytest.fixture
def cached_test_data():
filename = os.path.join(
......@@ -145,3 +149,11 @@ def client(app_config):
os.environ["SETTINGS_FILENAME"] = app_config
with inventory_provider.create_app().test_client() as c:
yield c
def pytest_generate_tests(metafunc):
params = _tmp_data_config()
metafunc.parametrize(
"router",
list([r['hostname'] for r in params['routers']])
)
......@@ -23,12 +23,9 @@ class MockedJunosDevice(object):
pass
def test_query_doc_and_validate(mocker, data_config):
def test_query_doc_and_validate(mocker, router, data_config):
mocker.patch(
'inventory_provider.netconf.Device',
MockedJunosDevice)
for r in data_config['routers']:
doc = netconf.load_config(r['hostname'], data_config['ssh'])
netconf.load_config(router, data_config['ssh'])
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