summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_bad_input_tests.py65
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_predicates_tests.py11
-rw-r--r--roles/openshift_master_facts/test/openshift_master_facts_default_priorities_tests.py11
3 files changed, 42 insertions, 45 deletions
diff --git a/roles/openshift_master_facts/test/openshift_master_facts_bad_input_tests.py b/roles/openshift_master_facts/test/openshift_master_facts_bad_input_tests.py
index ec6c7ae4a..e8da1e04a 100644
--- a/roles/openshift_master_facts/test/openshift_master_facts_bad_input_tests.py
+++ b/roles/openshift_master_facts/test/openshift_master_facts_bad_input_tests.py
@@ -3,7 +3,7 @@ import os
import sys
from ansible.errors import AnsibleError
-from nose.tools import raises
+import pytest
sys.path.insert(1, os.path.join(os.path.dirname(__file__), os.pardir, "lookup_plugins"))
@@ -11,48 +11,47 @@ from openshift_master_facts_default_predicates import LookupModule # noqa: E402
class TestOpenShiftMasterFactsBadInput(object):
- def setUp(self):
- self.lookup = LookupModule()
- self.default_facts = {
- 'openshift': {
- 'common': {}
- }
+ lookup = LookupModule()
+ default_facts = {
+ 'openshift': {
+ 'common': {}
}
+ }
- @raises(AnsibleError)
def test_missing_openshift_facts(self):
- facts = {}
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = {}
+ self.lookup.run(None, variables=facts)
- @raises(AnsibleError)
def test_missing_deployment_type(self):
- facts = copy.deepcopy(self.default_facts)
- facts['openshift']['common']['short_version'] = '10.10'
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = copy.deepcopy(self.default_facts)
+ facts['openshift']['common']['short_version'] = '10.10'
+ self.lookup.run(None, variables=facts)
- @raises(AnsibleError)
def test_missing_short_version_and_missing_openshift_release(self):
- facts = copy.deepcopy(self.default_facts)
- facts['openshift']['common']['deployment_type'] = 'origin'
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = copy.deepcopy(self.default_facts)
+ facts['openshift']['common']['deployment_type'] = 'origin'
+ self.lookup.run(None, variables=facts)
- @raises(AnsibleError)
def test_unknown_deployment_types(self):
- facts = copy.deepcopy(self.default_facts)
- facts['openshift']['common']['short_version'] = '1.1'
- facts['openshift']['common']['deployment_type'] = 'bogus'
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = copy.deepcopy(self.default_facts)
+ facts['openshift']['common']['short_version'] = '1.1'
+ facts['openshift']['common']['deployment_type'] = 'bogus'
+ self.lookup.run(None, variables=facts)
- @raises(AnsibleError)
def test_unknown_origin_version(self):
- facts = copy.deepcopy(self.default_facts)
- facts['openshift']['common']['short_version'] = '0.1'
- facts['openshift']['common']['deployment_type'] = 'origin'
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = copy.deepcopy(self.default_facts)
+ facts['openshift']['common']['short_version'] = '0.1'
+ facts['openshift']['common']['deployment_type'] = 'origin'
+ self.lookup.run(None, variables=facts)
- @raises(AnsibleError)
def test_unknown_ocp_version(self):
- facts = copy.deepcopy(self.default_facts)
- facts['openshift']['common']['short_version'] = '0.1'
- facts['openshift']['common']['deployment_type'] = 'openshift-enterprise'
- self.lookup.run(None, variables=facts)
+ with pytest.raises(AnsibleError):
+ facts = copy.deepcopy(self.default_facts)
+ facts['openshift']['common']['short_version'] = '0.1'
+ facts['openshift']['common']['deployment_type'] = 'openshift-enterprise'
+ self.lookup.run(None, variables=facts)
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 855f42273..51547ce7e 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
@@ -86,13 +86,12 @@ TEST_VARS = [
class TestOpenShiftMasterFactsDefaultPredicates(object):
- def setUp(self):
- self.lookup = LookupModule()
- self.default_facts = {
- 'openshift': {
- 'common': {}
- }
+ lookup = LookupModule()
+ default_facts = {
+ 'openshift': {
+ 'common': {}
}
+ }
def test_openshift_version(self):
for regions_enabled in (True, False):
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 d27a48ede..4fb900b98 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
@@ -74,13 +74,12 @@ TEST_VARS = [
class TestOpenShiftMasterFactsDefaultPredicates(object):
- def setUp(self):
- self.lookup = LookupModule()
- self.default_facts = {
- 'openshift': {
- 'common': {}
- }
+ lookup = LookupModule()
+ default_facts = {
+ 'openshift': {
+ 'common': {}
}
+ }
def test_openshift_version(self):
for zones_enabled in (True, False):