Merge "add functional tests for identity v2"
This commit is contained in:
commit
1ea34fc8a5
42
functional/tests/identity/v2/test_catalog.py
Normal file
42
functional/tests/identity/v2/test_catalog.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class CatalogTests(test_identity.IdentityTests):
|
||||
|
||||
def test_catalog_list(self):
|
||||
raw_output = self.openstack('catalog list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, self.CATALOG_LIST_HEADERS)
|
||||
|
||||
def test_catalog_show(self):
|
||||
"""test catalog show command
|
||||
|
||||
The output example:
|
||||
+-----------+-------------------------------------------+
|
||||
| Field | Value |
|
||||
+-----------+-------------------------------------------+
|
||||
| endpoints | test1 |
|
||||
| | publicURL: http://localhost:5000/v2.0 |
|
||||
| | internalURL: http://localhost:5000/v2.0 |
|
||||
| | adminURL: http://localhost:5000/v2.0 |
|
||||
| | |
|
||||
| name | keystone |
|
||||
| type | identity |
|
||||
+-----------+-------------------------------------------+
|
||||
"""
|
||||
raw_output = self.openstack('catalog show %s' % 'identity')
|
||||
items = self.parse_show(raw_output)
|
||||
# items may have multiple endpoint urls with empty key
|
||||
self.assert_show_fields(items, ['endpoints', 'name', 'type', ''])
|
40
functional/tests/identity/v2/test_ec2_credentials.py
Normal file
40
functional/tests/identity/v2/test_ec2_credentials.py
Normal file
@ -0,0 +1,40 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class EC2CredentialsTests(test_identity.IdentityTests):
|
||||
|
||||
def test_ec2_credentials_create(self):
|
||||
self._create_dummy_ec2_credentials()
|
||||
|
||||
def test_ec2_credentials_delete(self):
|
||||
access_key = self._create_dummy_ec2_credentials(add_clean_up=False)
|
||||
raw_output = self.openstack(
|
||||
'ec2 credentials delete %s' % access_key,
|
||||
)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
def test_ec2_credentials_list(self):
|
||||
self._create_dummy_ec2_credentials()
|
||||
raw_output = self.openstack('ec2 credentials list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, self.EC2_CREDENTIALS_LIST_HEADERS)
|
||||
|
||||
def test_ec2_credentials_show(self):
|
||||
access_key = self._create_dummy_ec2_credentials()
|
||||
show_output = self.openstack(
|
||||
'ec2 credentials show %s' % access_key,
|
||||
)
|
||||
items = self.parse_show(show_output)
|
||||
self.assert_show_fields(items, self.EC2_CREDENTIALS_FIELDS)
|
@ -10,7 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from functional.common import exceptions
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
||||
from functional.common import test
|
||||
|
||||
BASIC_LIST_HEADERS = ['ID', 'Name']
|
||||
@ -19,96 +20,110 @@ BASIC_LIST_HEADERS = ['ID', 'Name']
|
||||
class IdentityTests(test.TestCase):
|
||||
"""Functional tests for Identity commands. """
|
||||
|
||||
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'project_id', 'username']
|
||||
PROJECT_FIELDS = ['enabled', 'id', 'name', 'description']
|
||||
EC2_CREDENTIALS_FIELDS = [
|
||||
'access',
|
||||
'project_id',
|
||||
'secret',
|
||||
'trust_id',
|
||||
'user_id',
|
||||
]
|
||||
EC2_CREDENTIALS_LIST_HEADERS = [
|
||||
'Access',
|
||||
'Secret',
|
||||
'Project ID',
|
||||
'User ID',
|
||||
]
|
||||
USER_FIELDS = ['email', 'enabled', 'id', 'name', 'project_id',
|
||||
'username', 'domain_id', 'default_project_id']
|
||||
PROJECT_FIELDS = ['enabled', 'id', 'name', 'description', 'domain_id']
|
||||
TOKEN_FIELDS = ['expires', 'id', 'project_id', 'user_id']
|
||||
ROLE_FIELDS = ['id', 'name', 'links']
|
||||
|
||||
def test_user_list(self):
|
||||
raw_output = self.openstack('user list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, BASIC_LIST_HEADERS)
|
||||
EC2_CREDENTIALS_FIELDS = ['access', 'project_id', 'secret',
|
||||
'trust_id', 'user_id']
|
||||
EC2_CREDENTIALS_LIST_HEADERS = ['Access', 'Secret',
|
||||
'Project ID', 'User ID']
|
||||
CATALOG_LIST_HEADERS = ['Name', 'Type', 'Endpoints']
|
||||
|
||||
def test_user_show(self):
|
||||
raw_output = self.openstack('user show admin')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.USER_FIELDS)
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if hasattr(super(IdentityTests, cls), 'setUpClass'):
|
||||
super(IdentityTests, cls).setUpClass()
|
||||
|
||||
def test_user_create(self):
|
||||
raw_output = self.openstack('user create mjordan --password bulls'
|
||||
' --email hoops@example.com')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.USER_FIELDS)
|
||||
# create dummy project
|
||||
cls.project_name = data_utils.rand_name('TestProject')
|
||||
cls.project_description = data_utils.rand_name('description')
|
||||
cls.openstack(
|
||||
'project create '
|
||||
'--description %(description)s '
|
||||
'--enable '
|
||||
'%(name)s' % {'description': cls.project_description,
|
||||
'name': cls.project_name})
|
||||
|
||||
def test_user_delete(self):
|
||||
self.openstack('user create dummy')
|
||||
raw_output = self.openstack('user delete dummy')
|
||||
self.assertEqual(0, len(raw_output))
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.openstack('project delete %s' % cls.project_name)
|
||||
|
||||
def test_bad_user_command(self):
|
||||
self.assertRaises(exceptions.CommandFailed,
|
||||
self.openstack, 'user unlist')
|
||||
if hasattr(super(IdentityTests, cls), 'tearDownClass'):
|
||||
super(IdentityTests, cls).tearDownClass()
|
||||
|
||||
def test_project_list(self):
|
||||
raw_output = self.openstack('project list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, BASIC_LIST_HEADERS)
|
||||
|
||||
def test_project_show(self):
|
||||
raw_output = self.openstack('project show admin')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.PROJECT_FIELDS)
|
||||
|
||||
def test_project_create(self):
|
||||
raw_output = self.openstack('project create test-project')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.PROJECT_FIELDS)
|
||||
|
||||
def test_project_delete(self):
|
||||
self.openstack('project create dummy-project')
|
||||
raw_output = self.openstack('project delete dummy-project')
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
def test_ec2_credentials_create(self):
|
||||
create_output = self.openstack('ec2 credentials create')
|
||||
create_items = self.parse_show(create_output)
|
||||
self.openstack(
|
||||
'ec2 credentials delete %s' % create_items[0]['access'],
|
||||
)
|
||||
self.assert_show_fields(create_items, self.EC2_CREDENTIALS_FIELDS)
|
||||
|
||||
def test_ec2_credentials_delete(self):
|
||||
create_output = self.openstack('ec2 credentials create')
|
||||
create_items = self.parse_show(create_output)
|
||||
def _create_dummy_project(self, add_clean_up=True):
|
||||
project_name = data_utils.rand_name('TestProject')
|
||||
project_description = data_utils.rand_name('description')
|
||||
raw_output = self.openstack(
|
||||
'ec2 credentials delete %s' % create_items[0]['access'],
|
||||
)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
'project create '
|
||||
'--description %(description)s '
|
||||
'--enable %(name)s' % {'description': project_description,
|
||||
'name': project_name})
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.PROJECT_FIELDS)
|
||||
project = self.parse_show_as_object(raw_output)
|
||||
if add_clean_up:
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'project delete %s' % project['id'])
|
||||
return project_name
|
||||
|
||||
def test_ec2_credentials_list(self):
|
||||
raw_output = self.openstack('ec2 credentials list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, self.EC2_CREDENTIALS_LIST_HEADERS)
|
||||
def _create_dummy_user(self, add_clean_up=True):
|
||||
username = data_utils.rand_name('TestUser')
|
||||
password = data_utils.rand_name('password')
|
||||
email = data_utils.rand_name() + '@example.com'
|
||||
raw_output = self.openstack(
|
||||
'user create '
|
||||
'--project %(project)s '
|
||||
'--password %(password)s '
|
||||
'--email %(email)s '
|
||||
'--enable '
|
||||
'%(name)s' % {'project': self.project_name,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'name': username})
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.USER_FIELDS)
|
||||
if add_clean_up:
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'user delete %s' % self.parse_show_as_object(raw_output)['id'])
|
||||
return username
|
||||
|
||||
def test_ec2_credentials_show(self):
|
||||
create_output = self.openstack('ec2 credentials create')
|
||||
create_items = self.parse_show(create_output)
|
||||
show_output = self.openstack(
|
||||
'ec2 credentials show %s' % create_items[0]['access'],
|
||||
)
|
||||
items = self.parse_show(show_output)
|
||||
self.openstack(
|
||||
'ec2 credentials delete %s' % create_items[0]['access'],
|
||||
)
|
||||
def _create_dummy_role(self, add_clean_up=True):
|
||||
role_name = data_utils.rand_name('TestRole')
|
||||
raw_output = self.openstack('role create %s' % role_name)
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.ROLE_FIELDS)
|
||||
role = self.parse_show_as_object(raw_output)
|
||||
self.assertEqual(role_name, role['name'])
|
||||
if add_clean_up:
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'role delete %s' % role['id'])
|
||||
return role_name
|
||||
|
||||
def _create_dummy_ec2_credentials(self, add_clean_up=True):
|
||||
raw_output = self.openstack('ec2 credentials create')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.EC2_CREDENTIALS_FIELDS)
|
||||
ec2_credentials = self.parse_show_as_object(raw_output)
|
||||
access_key = ec2_credentials['access']
|
||||
if add_clean_up:
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'ec2 credentials delete %s' % access_key)
|
||||
return access_key
|
||||
|
||||
def _create_dummy_token(self, add_clean_up=True):
|
||||
raw_output = self.openstack('token issue')
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.TOKEN_FIELDS)
|
||||
token = self.parse_show_as_object(raw_output)
|
||||
if add_clean_up:
|
||||
self.addCleanup(self.openstack,
|
||||
'token revoke %s' % token['id'])
|
||||
return token['id']
|
||||
|
84
functional/tests/identity/v2/test_project.py
Normal file
84
functional/tests/identity/v2/test_project.py
Normal file
@ -0,0 +1,84 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class ProjectTests(test_identity.IdentityTests):
|
||||
|
||||
def test_project_create(self):
|
||||
project_name = data_utils.rand_name('TestProject')
|
||||
description = data_utils.rand_name('description')
|
||||
raw_output = self.openstack(
|
||||
'project create '
|
||||
'--description %(description)s '
|
||||
'--enable '
|
||||
'--property k1=v1 '
|
||||
'--property k2=v2 '
|
||||
'%(name)s' % {'description': description,
|
||||
'name': project_name})
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'project delete %s' % project_name
|
||||
)
|
||||
items = self.parse_show(raw_output)
|
||||
show_fields = list(self.PROJECT_FIELDS)
|
||||
show_fields.extend(['k1', 'k2'])
|
||||
self.assert_show_fields(items, show_fields)
|
||||
project = self.parse_show_as_object(raw_output)
|
||||
self.assertEqual('v1', project['k1'])
|
||||
self.assertEqual('v2', project['k2'])
|
||||
|
||||
def test_project_delete(self):
|
||||
project_name = self._create_dummy_project(add_clean_up=False)
|
||||
raw_output = self.openstack(
|
||||
'project delete %s' % project_name)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
def test_project_list(self):
|
||||
raw_output = self.openstack('project list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS)
|
||||
|
||||
def test_project_set(self):
|
||||
project_name = self._create_dummy_project()
|
||||
new_project_name = data_utils.rand_name('NewTestProject')
|
||||
raw_output = self.openstack(
|
||||
'project set '
|
||||
'--name %(new_name)s '
|
||||
'--disable '
|
||||
'--property k0=v0 '
|
||||
'%(name)s' % {'new_name': new_project_name,
|
||||
'name': project_name})
|
||||
self.assertEqual(0, len(raw_output))
|
||||
# check project details
|
||||
raw_output = self.openstack(
|
||||
'project show %s' % new_project_name
|
||||
)
|
||||
items = self.parse_show(raw_output)
|
||||
fields = list(self.PROJECT_FIELDS)
|
||||
fields.extend(['k0'])
|
||||
self.assert_show_fields(items, fields)
|
||||
project = self.parse_show_as_object(raw_output)
|
||||
self.assertEqual(new_project_name, project['name'])
|
||||
self.assertEqual('False', project['enabled'])
|
||||
self.assertEqual('v0', project['k0'])
|
||||
|
||||
def test_project_show(self):
|
||||
project_name = self._create_dummy_project()
|
||||
raw_output = self.openstack(
|
||||
'project show %s' % project_name
|
||||
)
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.PROJECT_FIELDS)
|
109
functional/tests/identity/v2/test_role.py
Normal file
109
functional/tests/identity/v2/test_role.py
Normal file
@ -0,0 +1,109 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class RoleTests(test_identity.IdentityTests):
|
||||
|
||||
def test_role_create(self):
|
||||
self._create_dummy_role()
|
||||
|
||||
def test_role_delete(self):
|
||||
role_name = self._create_dummy_role(add_clean_up=False)
|
||||
raw_output = self.openstack('role delete %s' % role_name)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
def test_role_list(self):
|
||||
self._create_dummy_role()
|
||||
raw_output = self.openstack('role list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS)
|
||||
|
||||
def test_role_list_with_user_project(self):
|
||||
project_name = self._create_dummy_project()
|
||||
role_name = self._create_dummy_role()
|
||||
username = self._create_dummy_user()
|
||||
raw_output = self.openstack(
|
||||
'role add '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.ROLE_FIELDS)
|
||||
raw_output = self.openstack(
|
||||
'role list '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'' % {'project': project_name,
|
||||
'user': username})
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS)
|
||||
self.assertEqual(1, len(items))
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'role remove '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
|
||||
def test_role_show(self):
|
||||
role_name = self._create_dummy_role()
|
||||
raw_output = self.openstack('role show %s' % role_name)
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.ROLE_FIELDS)
|
||||
|
||||
def test_role_add(self):
|
||||
role_name = self._create_dummy_role()
|
||||
username = self._create_dummy_user()
|
||||
raw_output = self.openstack(
|
||||
'role add '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': self.project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.ROLE_FIELDS)
|
||||
self.addCleanup(
|
||||
self.openstack,
|
||||
'role remove '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': self.project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
|
||||
def test_role_remove(self):
|
||||
role_name = self._create_dummy_role()
|
||||
username = self._create_dummy_user()
|
||||
raw_output = self.openstack(
|
||||
'role add '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': self.project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.ROLE_FIELDS)
|
||||
raw_output = self.openstack(
|
||||
'role remove '
|
||||
'--project %(project)s '
|
||||
'--user %(user)s '
|
||||
'%(role)s' % {'project': self.project_name,
|
||||
'user': username,
|
||||
'role': role_name})
|
||||
self.assertEqual(0, len(raw_output))
|
24
functional/tests/identity/v2/test_token.py
Normal file
24
functional/tests/identity/v2/test_token.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class TokenTests(test_identity.IdentityTests):
|
||||
|
||||
def test_token_issue(self):
|
||||
self._create_dummy_token()
|
||||
|
||||
def test_token_revoke(self):
|
||||
token_id = self._create_dummy_token(add_clean_up=False)
|
||||
raw_output = self.openstack('token revoke %s' % token_id)
|
||||
self.assertEqual(0, len(raw_output))
|
60
functional/tests/identity/v2/test_user.py
Normal file
60
functional/tests/identity/v2/test_user.py
Normal file
@ -0,0 +1,60 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
||||
from functional.common import exceptions
|
||||
from functional.tests.identity.v2 import test_identity
|
||||
|
||||
|
||||
class UserTests(test_identity.IdentityTests):
|
||||
|
||||
def test_user_create(self):
|
||||
self._create_dummy_user()
|
||||
|
||||
def test_user_delete(self):
|
||||
username = self._create_dummy_user(add_clean_up=False)
|
||||
raw_output = self.openstack('user delete %s' % username)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
def test_user_list(self):
|
||||
raw_output = self.openstack('user list')
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, test_identity.BASIC_LIST_HEADERS)
|
||||
|
||||
def test_user_set(self):
|
||||
username = self._create_dummy_user()
|
||||
raw_output = self.openstack('user show %s' % username)
|
||||
user = self.parse_show_as_object(raw_output)
|
||||
new_username = data_utils.rand_name('NewTestUser')
|
||||
new_email = data_utils.rand_name() + '@example.com'
|
||||
raw_output = self.openstack('user set '
|
||||
'--email %(email)s '
|
||||
'--name %(new_name)s '
|
||||
'%(id)s' % {'email': new_email,
|
||||
'new_name': new_username,
|
||||
'id': user['id']})
|
||||
self.assertEqual(0, len(raw_output))
|
||||
raw_output = self.openstack('user show %s' % new_username)
|
||||
new_user = self.parse_show_as_object(raw_output)
|
||||
self.assertEqual(user['id'], new_user['id'])
|
||||
self.assertEqual(new_email, new_user['email'])
|
||||
|
||||
def test_user_show(self):
|
||||
username = self._create_dummy_user()
|
||||
raw_output = self.openstack('user show %s' % username)
|
||||
items = self.parse_show(raw_output)
|
||||
self.assert_show_fields(items, self.USER_FIELDS)
|
||||
|
||||
def test_bad_user_command(self):
|
||||
self.assertRaises(exceptions.CommandFailed,
|
||||
self.openstack, 'user unlist')
|
Loading…
x
Reference in New Issue
Block a user