From fd18d52e94cc293c32bb7f69a00ec4604bdace0e Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sat, 21 Apr 2018 12:52:29 +0200 Subject: Switch from deploy utils to the right objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also prints the full exceptions and removes useless casts. Change-Id: I19ff1ae90670833f998c0d17592da82207235229 Signed-off-by: Cédric Ollivier --- functest/tests/unit/openstack/vping/test_vping.py | 38 +++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'functest/tests/unit/openstack') diff --git a/functest/tests/unit/openstack/vping/test_vping.py b/functest/tests/unit/openstack/vping/test_vping.py index 3aaa4594a..adc0f69a6 100644 --- a/functest/tests/unit/openstack/vping/test_vping.py +++ b/functest/tests/unit/openstack/vping/test_vping.py @@ -60,14 +60,16 @@ class VPingUserdataTesting(unittest.TestCase): 'get_ext_net_name', return_value='foo') def test_vping_userdata(self, *args): # pylint: disable=unused-argument - with mock.patch('snaps.openstack.utils.deploy_utils.create_image', + with mock.patch('snaps.openstack.create_image.OpenStackImage.create', return_value=OpenStackImage(self.os_creds, None)), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_network', - return_value=OpenStackNetwork( - self.os_creds, NetworkConfig(name='foo'))), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_router', - return_value=OpenStackRouter( - self.os_creds, RouterConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_network.OpenStackNetwork.create', + return_value=OpenStackNetwork( + self.os_creds, NetworkConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_router.OpenStackRouter.create', + return_value=OpenStackRouter( + self.os_creds, RouterConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( @@ -133,14 +135,15 @@ class VPingSSHTesting(unittest.TestCase): cidr='10.0.0.1/24', dns_nameservers=[env.get('NAMESERVER')]) - with mock.patch('snaps.openstack.utils.deploy_utils.create_image', + with mock.patch('snaps.openstack.create_image.OpenStackImage.create', return_value=OpenStackImage(self.os_creds, None)), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_network', - return_value=OpenStackNetwork( - self.os_creds, - NetworkConfig( - name='foo', - subnet_settings=[subnet_config]))), \ + mock.patch( + 'snaps.openstack.create_network.OpenStackNetwork.create', + return_value=OpenStackNetwork( + self.os_creds, + NetworkConfig( + name='foo', + subnet_settings=[subnet_config]))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_vm_instance', return_value=OpenStackVmInstance( @@ -153,9 +156,10 @@ class VPingSSHTesting(unittest.TestCase): mock.patch('snaps.openstack.utils.deploy_utils.create_keypair', return_value=OpenStackKeypair( self.os_creds, KeypairConfig(name='foo'))), \ - mock.patch('snaps.openstack.utils.deploy_utils.create_router', - return_value=OpenStackRouter( - self.os_creds, RouterConfig(name='foo'))), \ + mock.patch( + 'snaps.openstack.create_router.OpenStackRouter.create', + return_value=OpenStackRouter( + self.os_creds, RouterConfig(name='foo'))), \ mock.patch('snaps.openstack.utils.deploy_utils.' 'create_security_group', return_value=OpenStackSecurityGroup( -- cgit 1.2.3-korg