def setUp(self, mock_func1, mock_func2, mock_func3): self.rally_base = rally.RallyBase() self.rally_base.network_dict['net_id'] = 'test_net_id' self.polling_iter = 2 mock_func1.assert_called() mock_func2.assert_called() mock_func3.assert_called()
def setUp(self): os_creds = OSCreds( username='******', password='******', auth_url='http://foo.com:5000/v3', project_name='bar') with mock.patch('snaps.openstack.tests.openstack_tests.' 'get_credentials', return_value=os_creds) as m: self.rally_base = rally.RallyBase() self.polling_iter = 2 self.assertTrue(m.called)
def setUp(self): with mock.patch('os_client_config.get_config') as mock_get_config, \ mock.patch('shade.OpenStackCloud') as mock_shade: self.rally_base = rally.RallyBase() self.rally_base.image = munch.Munch(name='foo') self.rally_base.flavor = munch.Munch(name='foo') self.rally_base.flavor_alt = munch.Munch(name='bar') self.assertTrue(mock_get_config.called) self.assertTrue(mock_shade.called)
def setUp(self): os_creds = OSCreds( username='******', password='******', auth_url='http://foo.com:5000/v3', project_name='bar') with mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' 'get_credentials', return_value=os_creds) as mock_get_creds: self.rally_base = rally.RallyBase() self.assertTrue(mock_get_creds.called)
def setUp(self): 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.rally_base = rally.RallyBase() self.rally_base.image = munch.Munch(name='foo') self.rally_base.flavor = munch.Munch(name='foo') self.rally_base.flavor_alt = munch.Munch(name='bar') self.assertTrue(mock_get_config.called) self.assertTrue(mock_shade.called) self.assertTrue(mock_new_project.called)
def setUp(self): self.nova_client = mock.Mock() self.neutron_client = mock.Mock() self.cinder_client = mock.Mock() with mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_nova_client', return_value=self.nova_client), \ mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_neutron_client', return_value=self.neutron_client), \ mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_cinder_client', return_value=self.cinder_client): self.rally_base = rally.RallyBase() self.rally_base.network_dict['net_id'] = 'test_net_id' self.polling_iter = 2
def setUp(self): with mock.patch('os_client_config.make_shade') as mock_make_shade: self.rally_base = rally.RallyBase() self.assertTrue(mock_make_shade.called)