Files
python-keystoneclient/keystoneclient/tests/functional/v3/client_fixtures.py
Samuel de Medeiros Queiroz a83432973d Add users functional tests
Adds initial set of functional tests for users. For now, all the tests
are created under a single class. Once we have a gate that runs against
LDAP, we will create a class that only contains readonly tests and a
tox call for it (e.g tox -e functional-readonly).

Change-Id: Ie41872a1ad86db6219dd0af47dbc3e2db46bd878
2016-05-12 18:25:22 -03:00

56 lines
1.6 KiB
Python

# 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.
import fixtures
import uuid
RESOURCE_NAME_PREFIX = 'keystoneclient-functional-'
class Base(fixtures.Fixture):
def __init__(self, client, domain_id):
super(Base, self).__init__()
self.client = client
self.domain_id = domain_id
self.ref = None
self.entity = None
def __getattr__(self, name):
"""Return the attribute from the represented entity."""
return getattr(self.entity, name)
class User(Base):
def setUp(self):
super(User, self).setUp()
self.ref = {'name': RESOURCE_NAME_PREFIX + uuid.uuid4().hex,
'domain': self.domain_id}
self.entity = self.client.users.create(**self.ref)
self.addCleanup(self.client.users.delete, self.entity)
class Group(Base):
def setUp(self):
super(Group, self).setUp()
self.ref = {'name': RESOURCE_NAME_PREFIX + uuid.uuid4().hex,
'domain': self.domain_id}
self.entity = self.client.groups.create(**self.ref)
self.addCleanup(self.client.groups.delete, self.entity)