aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit/openstack/tempest
diff options
context:
space:
mode:
authorCedric Ollivier <cedric.ollivier@orange.com>2018-04-13 15:42:53 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-04-13 15:42:53 +0000
commit11376429e4a807790da32ea9b9eaf4856530baee (patch)
tree2c370ed280a19fbb16d058942c2812d7eac39491 /functest/tests/unit/openstack/tempest
parent0c03217da792ecf206d1d4443f7b4a7e79d5e2fb (diff)
parent71c4b3b719289929c226cae60eb1b23ada16eeb2 (diff)
Merge "Fix role processing in Patrole"
Diffstat (limited to 'functest/tests/unit/openstack/tempest')
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py26
-rw-r--r--functest/tests/unit/openstack/tempest/test_tempest.py16
2 files changed, 17 insertions, 25 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index 161d9c076..8988e96a1 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -188,28 +188,6 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
self.assertTrue(mock_get_vid.called)
self.assertTrue(mock_get_did.called)
- def test_backup_config_default(self):
- with mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.os.path.exists',
- return_value=False), \
- mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.os.makedirs') as mock_makedirs, \
- mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.shutil.copyfile') as mock_copyfile:
- conf_utils.backup_tempest_config(
- 'test_conf_file', res_dir='test_dir')
- self.assertTrue(mock_makedirs.called)
- self.assertTrue(mock_copyfile.called)
-
- with mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.os.path.exists',
- return_value=True), \
- mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.shutil.copyfile') as mock_copyfile:
- conf_utils.backup_tempest_config(
- 'test_conf_file', res_dir='test_dir')
- self.assertTrue(mock_copyfile.called)
-
def _test_missing_param(self, params, image_id, flavor_id):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
'conf_utils.ConfigParser.RawConfigParser.'
@@ -221,13 +199,11 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
'conf_utils.ConfigParser.RawConfigParser.'
'write') as mwrite, \
mock.patch('__builtin__.open', mock.mock_open()), \
- mock.patch('functest.opnfv_tests.openstack.tempest.'
- 'conf_utils.backup_tempest_config'), \
mock.patch('functest.utils.functest_utils.yaml.safe_load',
return_value={'validation': {'ssh_timeout': 300}}):
os.environ['OS_ENDPOINT_TYPE'] = ''
conf_utils.configure_tempest_update_params(
- 'test_conf_file', res_dir='test_dir', image_id=image_id,
+ 'test_conf_file', image_id=image_id,
flavor_id=flavor_id)
mset.assert_any_call(params[0], params[1], params[2])
self.assertTrue(mread.called)
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py
index 5328b0650..fc8c9cc85 100644
--- a/functest/tests/unit/openstack/tempest/test_tempest.py
+++ b/functest/tests/unit/openstack/tempest/test_tempest.py
@@ -20,6 +20,7 @@ from functest.opnfv_tests.openstack.tempest import conf_utils
class OSTempestTesting(unittest.TestCase):
+ # pylint: disable=too-many-public-methods
def setUp(self):
os_creds = OSCreds(
@@ -101,6 +102,21 @@ class OSTempestTesting(unittest.TestCase):
with self.assertRaises(Exception):
self.tempestcommon.parse_verifier_result()
+ def test_backup_config_default(self):
+ with mock.patch('os.path.exists', return_value=False), \
+ mock.patch('os.makedirs') as mock_makedirs, \
+ mock.patch('shutil.copyfile') as mock_copyfile:
+ self.tempestcommon.backup_tempest_config(
+ 'test_conf_file', res_dir='test_dir')
+ self.assertTrue(mock_makedirs.called)
+ self.assertTrue(mock_copyfile.called)
+
+ with mock.patch('os.path.exists', return_value=True), \
+ mock.patch('shutil.copyfile') as mock_copyfile:
+ self.tempestcommon.backup_tempest_config(
+ 'test_conf_file', res_dir='test_dir')
+ self.assertTrue(mock_copyfile.called)
+
@mock.patch("os.rename")
@mock.patch("os.remove")
@mock.patch("os.path.exists", return_value=True)