summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py40
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py40
2 files changed, 24 insertions, 56 deletions
diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
index bef02e548..25294d91a 100644
--- a/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
+++ b/roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py
@@ -80,15 +80,19 @@ TEST_VARS = [
]
-def test_openshift_version(predicates_lookup, openshift_version_fixture, regions_enabled):
- facts, default_predicates = openshift_version_fixture
- results = predicates_lookup.run(None, variables=facts, regions_enabled=regions_enabled)
+def assert_ok(predicates_lookup, default_predicates, regions_enabled, **kwargs):
+ results = predicates_lookup.run(None, regions_enabled=regions_enabled, **kwargs)
if regions_enabled:
assert results == default_predicates + [REGION_PREDICATE]
else:
assert results == default_predicates
+def test_openshift_version(predicates_lookup, openshift_version_fixture, regions_enabled):
+ facts, default_predicates = openshift_version_fixture
+ assert_ok(predicates_lookup, default_predicates, variables=facts, regions_enabled=regions_enabled)
+
+
@pytest.fixture(params=TEST_VARS)
def openshift_version_fixture(request, facts):
version, deployment_type, default_predicates = request.param
@@ -100,11 +104,7 @@ def openshift_version_fixture(request, facts):
def test_openshift_release(predicates_lookup, openshift_release_fixture, regions_enabled):
facts, default_predicates = openshift_release_fixture
- results = predicates_lookup.run(None, variables=facts, regions_enabled=regions_enabled)
- if regions_enabled:
- assert results == default_predicates + [REGION_PREDICATE]
- else:
- assert results == default_predicates
+ assert_ok(predicates_lookup, default_predicates, variables=facts, regions_enabled=regions_enabled)
@pytest.fixture(params=TEST_VARS)
@@ -117,11 +117,7 @@ def openshift_release_fixture(request, facts, release_mod):
def test_short_version(predicates_lookup, short_version_fixture, regions_enabled):
facts, default_predicates = short_version_fixture
- results = predicates_lookup.run(None, variables=facts, regions_enabled=regions_enabled)
- if regions_enabled:
- assert results == default_predicates + [REGION_PREDICATE]
- else:
- assert results == default_predicates
+ assert_ok(predicates_lookup, default_predicates, variables=facts, regions_enabled=regions_enabled)
@pytest.fixture(params=TEST_VARS)
@@ -134,11 +130,7 @@ def short_version_fixture(request, facts):
def test_short_version_kwarg(predicates_lookup, short_version_kwarg_fixture, regions_enabled):
facts, short_version, default_predicates = short_version_kwarg_fixture
- results = predicates_lookup.run(None, variables=facts, regions_enabled=regions_enabled, short_version=short_version)
- if regions_enabled:
- assert results == default_predicates + [REGION_PREDICATE]
- else:
- assert results == default_predicates
+ assert_ok(predicates_lookup, default_predicates, variables=facts, regions_enabled=regions_enabled, short_version=short_version)
@pytest.fixture(params=TEST_VARS)
@@ -150,11 +142,7 @@ def short_version_kwarg_fixture(request, facts):
def test_deployment_type_kwarg(predicates_lookup, deployment_type_kwarg_fixture, regions_enabled):
facts, deployment_type, default_predicates = deployment_type_kwarg_fixture
- results = predicates_lookup.run(None, variables=facts, regions_enabled=regions_enabled, deployment_type=deployment_type)
- if regions_enabled:
- assert results == default_predicates + [REGION_PREDICATE]
- else:
- assert results == default_predicates
+ assert_ok(predicates_lookup, default_predicates, variables=facts, regions_enabled=regions_enabled, deployment_type=deployment_type)
@pytest.fixture(params=TEST_VARS)
@@ -166,11 +154,7 @@ def deployment_type_kwarg_fixture(request, facts):
def test_short_version_deployment_type_kwargs(predicates_lookup, short_version_deployment_type_kwargs_fixture, regions_enabled):
short_version, deployment_type, default_predicates = short_version_deployment_type_kwargs_fixture
- results = predicates_lookup.run(None, regions_enabled=regions_enabled, short_version=short_version, deployment_type=deployment_type)
- if regions_enabled:
- assert results == default_predicates + [REGION_PREDICATE]
- else:
- assert results == default_predicates
+ assert_ok(predicates_lookup, default_predicates, regions_enabled=regions_enabled, short_version=short_version, deployment_type=deployment_type)
@pytest.fixture(params=TEST_VARS)
diff --git a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
index 1343acb56..cec44faa4 100644
--- a/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
+++ b/roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py
@@ -68,15 +68,19 @@ TEST_VARS = [
]
-def test_openshift_version(priorities_lookup, openshift_version_fixture, zones_enabled):
- facts, default_priorities = openshift_version_fixture
- results = priorities_lookup.run(None, variables=facts, zones_enabled=zones_enabled)
+def assert_ok(priorities_lookup, default_priorities, zones_enabled, **kwargs):
+ results = priorities_lookup.run(None, zones_enabled=zones_enabled, **kwargs)
if zones_enabled:
assert results == default_priorities + [ZONE_PRIORITY]
else:
assert results == default_priorities
+def test_openshift_version(priorities_lookup, openshift_version_fixture, zones_enabled):
+ facts, default_priorities = openshift_version_fixture
+ assert_ok(priorities_lookup, default_priorities, variables=facts, zones_enabled=zones_enabled)
+
+
@pytest.fixture(params=TEST_VARS)
def openshift_version_fixture(request, facts):
version, deployment_type, default_priorities = request.param
@@ -88,11 +92,7 @@ def openshift_version_fixture(request, facts):
def test_openshift_release(priorities_lookup, openshift_release_fixture, zones_enabled):
facts, default_priorities = openshift_release_fixture
- results = priorities_lookup.run(None, variables=facts, zones_enabled=zones_enabled)
- if zones_enabled:
- assert results == default_priorities + [ZONE_PRIORITY]
- else:
- assert results == default_priorities
+ assert_ok(priorities_lookup, default_priorities, variables=facts, zones_enabled=zones_enabled)
@pytest.fixture(params=TEST_VARS)
@@ -105,11 +105,7 @@ def openshift_release_fixture(request, facts, release_mod):
def test_short_version(priorities_lookup, short_version_fixture, zones_enabled):
facts, default_priorities = short_version_fixture
- results = priorities_lookup.run(None, variables=facts, zones_enabled=zones_enabled)
- if zones_enabled:
- assert results == default_priorities + [ZONE_PRIORITY]
- else:
- assert results == default_priorities
+ assert_ok(priorities_lookup, default_priorities, variables=facts, zones_enabled=zones_enabled)
@pytest.fixture(params=TEST_VARS)
@@ -122,11 +118,7 @@ def short_version_fixture(request, facts):
def test_short_version_kwarg(priorities_lookup, short_version_kwarg_fixture, zones_enabled):
facts, short_version, default_priorities = short_version_kwarg_fixture
- results = priorities_lookup.run(None, variables=facts, zones_enabled=zones_enabled, short_version=short_version)
- if zones_enabled:
- assert results == default_priorities + [ZONE_PRIORITY]
- else:
- assert results == default_priorities
+ assert_ok(priorities_lookup, default_priorities, variables=facts, zones_enabled=zones_enabled, short_version=short_version)
@pytest.fixture(params=TEST_VARS)
@@ -138,11 +130,7 @@ def short_version_kwarg_fixture(request, facts):
def test_deployment_type_kwarg(priorities_lookup, deployment_type_kwarg_fixture, zones_enabled):
facts, deployment_type, default_priorities = deployment_type_kwarg_fixture
- results = priorities_lookup.run(None, variables=facts, zones_enabled=zones_enabled, deployment_type=deployment_type)
- if zones_enabled:
- assert results == default_priorities + [ZONE_PRIORITY]
- else:
- assert results == default_priorities
+ assert_ok(priorities_lookup, default_priorities, variables=facts, zones_enabled=zones_enabled, deployment_type=deployment_type)
@pytest.fixture(params=TEST_VARS)
@@ -154,11 +142,7 @@ def deployment_type_kwarg_fixture(request, facts):
def test_short_version_deployment_type_kwargs(priorities_lookup, short_version_deployment_type_kwargs_fixture, zones_enabled):
short_version, deployment_type, default_priorities = short_version_deployment_type_kwargs_fixture
- results = priorities_lookup.run(None, zones_enabled=zones_enabled, short_version=short_version, deployment_type=deployment_type)
- if zones_enabled:
- assert results == default_priorities + [ZONE_PRIORITY]
- else:
- assert results == default_priorities
+ assert_ok(priorities_lookup, default_priorities, zones_enabled=zones_enabled, short_version=short_version, deployment_type=deployment_type)
@pytest.fixture(params=TEST_VARS)