def test_register_vim_with_no_auth_url(self): cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None) my_id = 'my-id' name = 'test_vim' description = 'Vim Description' vim_config = utils.get_file_path( 'tests/unit/vm/samples/vim_config_without_auth_url.yaml') args = [ name, '--config-file', vim_config, '--description', description ] position_names = ['auth_cred', 'vim_project', 'auth_url'] position_values = [self.auth_cred, self.vim_project, self.auth_url] extra_body = { 'type': 'openstack', 'name': name, 'description': description, 'is_default': False } message = 'Auth URL must be specified' ex = self.assertRaises(exceptions.ApmecClientException, self._test_create_resource, self._RESOURCE, cmd, None, my_id, args, position_names, position_values, extra_body=extra_body) self.assertEqual(message, ex.message) self.assertEqual(404, ex.status_code)
def test_register_vim_all_params(self): cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None) name = 'my-name' my_id = 'my-id' description = 'Vim Description' vim_config = utils.get_file_path( 'tests/unit/vm/samples/vim_config.yaml') args = [ name, '--config-file', vim_config, '--description', description ] position_names = ['auth_cred', 'vim_project', 'auth_url'] position_values = [self.auth_cred, self.vim_project, self.auth_url] extra_body = { 'type': 'openstack', 'name': name, 'description': description, 'is_default': False } self._test_create_resource(self._RESOURCE, cmd, None, my_id, args, position_names, position_values, extra_body=extra_body)