From 5d9acb84f492dca4da863c60e30a5463fe165cb5 Mon Sep 17 00:00:00 2001 From: Juha Kosonen Date: Fri, 24 Aug 2018 10:41:49 +0300 Subject: Create new project/user for snaps tests JIRA: FUNCTEST-1003 Change-Id: Ic55998977386f95f619a355d22bd285782fe81f0 Signed-off-by: Juha Kosonen --- functest/tests/unit/openstack/snaps/test_snaps.py | 42 ++++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'functest/tests/unit') diff --git a/functest/tests/unit/openstack/snaps/test_snaps.py b/functest/tests/unit/openstack/snaps/test_snaps.py index a3760445f..14bc38596 100644 --- a/functest/tests/unit/openstack/snaps/test_snaps.py +++ b/functest/tests/unit/openstack/snaps/test_snaps.py @@ -22,7 +22,7 @@ from functest.opnfv_tests.openstack.snaps import smoke class APICheckTesting(unittest.TestCase): """ - Ensures the VPingUserdata class can run in Functest. This test does not + Ensures the ApiCheck class can run in Functest. This test does not actually connect with an OpenStack pod. """ @@ -30,9 +30,15 @@ class APICheckTesting(unittest.TestCase): self.os_creds = OSCreds( username='user', password='pass', auth_url='http://foo.com:5000/v3', project_name='bar') - - self.api_check = api_check.ApiCheck( - os_creds=self.os_creds, ext_net_name='foo') + with mock.patch('os_client_config.get_config') as mock_get_config, \ + mock.patch('shade.OpenStackCloud') as mock_shade, \ + mock.patch('functest.core.tenantnetwork.NewProject') \ + as mock_new_project: + self.api_check = api_check.ApiCheck( + os_creds=self.os_creds, ext_net_name='foo') + mock_get_config.assert_called() + mock_shade.assert_called() + mock_new_project.assert_called() @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' 'add_openstack_client_tests') @@ -93,7 +99,7 @@ class APICheckTesting(unittest.TestCase): class HealthCheckTesting(unittest.TestCase): """ - Ensures the VPingUserdata class can run in Functest. This test does not + Ensures the HealthCheck class can run in Functest. This test does not actually connect with an OpenStack pod. """ @@ -101,9 +107,15 @@ class HealthCheckTesting(unittest.TestCase): self.os_creds = OSCreds( username='user', password='pass', auth_url='http://foo.com:5000/v3', project_name='bar') - - self.health_check = health_check.HealthCheck( - os_creds=self.os_creds, ext_net_name='foo') + with mock.patch('os_client_config.get_config') as mock_get_config, \ + mock.patch('shade.OpenStackCloud') as mock_shade, \ + mock.patch('functest.core.tenantnetwork.NewProject') \ + as mock_new_project: + self.health_check = health_check.HealthCheck( + os_creds=self.os_creds, ext_net_name='foo') + mock_get_config.assert_called() + mock_shade.assert_called() + mock_new_project.assert_called() @mock.patch('snaps.openstack.tests.os_source_file_test.' 'OSIntegrationTestCase.parameterize') @@ -161,7 +173,7 @@ class HealthCheckTesting(unittest.TestCase): class SmokeTesting(unittest.TestCase): """ - Ensures the VPingUserdata class can run in Functest. This test does not + Ensures the SnapsSmoke class can run in Functest. This test does not actually connect with an OpenStack pod. """ @@ -169,9 +181,15 @@ class SmokeTesting(unittest.TestCase): self.os_creds = OSCreds( username='user', password='pass', auth_url='http://foo.com:5000/v3', project_name='bar') - - self.smoke = smoke.SnapsSmoke( - os_creds=self.os_creds, ext_net_name='foo') + with mock.patch('os_client_config.get_config') as mock_get_config, \ + mock.patch('shade.OpenStackCloud') as mock_shade, \ + mock.patch('functest.core.tenantnetwork.NewProject') \ + as mock_new_project: + self.smoke = smoke.SnapsSmoke( + os_creds=self.os_creds, ext_net_name='foo') + mock_get_config.assert_called() + mock_shade.assert_called() + mock_new_project.assert_called() @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' 'add_openstack_integration_tests') -- cgit 1.2.3-korg