Ejemplo n.º 1
0
 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.TackerClientException,
                            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)
Ejemplo n.º 2
0
    def test_register_vim_with_mandatory_params(self):
        cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None)
        name = 'my-name'
        my_id = 'my-id'

        vim_config = utils.get_file_path(
            'tests/unit/vm/samples/vim_k8s_bearer_token.yaml')
        args = [
            name,
            '--config-file',
            vim_config,
        ]
        position_names = ['auth_cred', 'vim_project', 'auth_url', 'type']
        position_values = [
            self.auth_cred, self.vim_project, self.auth_url, self.type
        ]
        extra_body = {'type': 'kubernetes', 'name': name, 'is_default': False}
        self._test_create_resource(self._RESOURCE,
                                   cmd,
                                   name,
                                   my_id,
                                   args,
                                   position_names,
                                   position_values,
                                   extra_body=extra_body)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 def test_register_vim_with_false_cert_verify(self):
     cmd = vim.CreateVIM(test_cli10.MyApp(sys.stdout), None)
     name = 'my-name'
     my_id = 'my-id'
     # change cert_verify to False
     self.auth_cred = {'username': '******', 'password': '******',
                       'user_domain_name': 'user_domain_name',
                       'cert_verify': 'False'}
     description = 'Vim Description'
     vim_config = utils.get_file_path(
         'tests/unit/vm/samples/vim_config_with_false_cert_verify.yaml')
     args = [
         name,
         '--config-file', vim_config,
         '--description', description]
     position_names = ['auth_cred', 'vim_project', 'auth_url', 'type']
     position_values = [self.auth_cred, self.vim_project,
                        self.auth_url, self.type]
     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)