Rebase keystone resources onto resource2
This patch also added some fields that were missing. Change-Id: I017261de2eba8980f7a4b578d51b0faccbd5042a
This commit is contained in:
parent
d7ee3ad86b
commit
4063801c86
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Credential(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Credential(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -31,14 +31,14 @@ class Credential(resource.Resource):
|
|||
# Properties
|
||||
#: Arbitrary blob of the credential data, to be parsed according to the
|
||||
#: ``type``. *Type: string*
|
||||
blob = resource.prop('blob')
|
||||
blob = resource.Body('blob')
|
||||
#: References a project ID which limits the scope the credential applies
|
||||
#: to. This attribute is **mandatory** if the credential type is ``ec2``.
|
||||
#: *Type: string*
|
||||
project_id = resource.prop('project_id')
|
||||
project_id = resource.Body('project_id')
|
||||
#: Representing the credential type, such as ``ec2`` or ``cert``.
|
||||
#: A specific implementation may determine the list of supported types.
|
||||
#: *Type: string*
|
||||
type = resource.prop('type')
|
||||
type = resource.Body('type')
|
||||
#: References the user ID which owns the credential. *Type: string*
|
||||
user_id = resource.prop('user_id')
|
||||
user_id = resource.Body('user_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Domain(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Domain(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,7 +30,7 @@ class Domain(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: The description of this domain. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Setting this attribute to ``False`` prevents users from authorizing
|
||||
#: against this domain or any projects owned by this domain, and prevents
|
||||
#: users owned by this domain from authenticating or receiving any other
|
||||
|
@ -38,6 +38,8 @@ class Domain(resource.Resource):
|
|||
#: to the above entities are immediately invalidated.
|
||||
#: Re-enabling a domain does not re-enable pre-existing tokens.
|
||||
#: *Type: bool*
|
||||
is_enabled = resource.prop('enabled', type=bool)
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
#: The globally unique name of this domain. *Type: string*
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The links related to the domain resource.
|
||||
links = resource.Body('links')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Endpoint(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Endpoint(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -40,14 +40,16 @@ class Endpoint(resource.Resource):
|
|||
#: access to the service, generally on a secure network interface
|
||||
#:
|
||||
#: *Type: string*
|
||||
interface = resource.prop('interface')
|
||||
interface = resource.Body('interface')
|
||||
#: Setting this value to ``False`` prevents the endpoint from appearing
|
||||
#: in the service catalog. *Type: bool*
|
||||
is_enabled = resource.prop('enabled', type=bool)
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
#: The links for the region resource.
|
||||
links = resource.Body('links')
|
||||
#: Represents the containing region ID of the service endpoint.
|
||||
#: *New in v3.2* *Type: string*
|
||||
region_id = resource.prop('region_id')
|
||||
region_id = resource.Body('region_id')
|
||||
#: References the service ID to which the endpoint belongs. *Type: string*
|
||||
service_id = resource.prop('service_id')
|
||||
service_id = resource.Body('service_id')
|
||||
#: Fully qualified URL of the service endpoint. *Type: string*
|
||||
url = resource.prop('url')
|
||||
url = resource.Body('url')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Group(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Group(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,11 +30,11 @@ class Group(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: The description of this group. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: References the domain ID which owns the group; if a domain ID is not
|
||||
#: specified by the client, the Identity service implementation will
|
||||
#: default it to the domain ID to which the client's token is scoped.
|
||||
#: *Type: string*
|
||||
domain_id = resource.prop('domain_id')
|
||||
domain_id = resource.Body('domain_id')
|
||||
#: Unique group name, within the owning domain. *Type: string*
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Policy(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Policy(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,6 +30,12 @@ class Policy(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: The policy rule set itself, as a serialized blob. *Type: string*
|
||||
blob = resource.prop('blob')
|
||||
blob = resource.Body('blob')
|
||||
#: The links for the policy resource.
|
||||
links = resource.Body('links')
|
||||
#: The ID for the project.
|
||||
project_id = resource.Body('project_id')
|
||||
#: The MIME Media Type of the serialized policy blob. *Type: string*
|
||||
type = resource.prop('type')
|
||||
type = resource.Body('type')
|
||||
#: The ID of the user who owns the policy
|
||||
user_id = resource.Body('user_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Project(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Project(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,16 +30,23 @@ class Project(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: The description of the project. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: References the domain ID which owns the project; if a domain ID is not
|
||||
#: specified by the client, the Identity service implementation will
|
||||
#: default it to the domain ID to which the client's token is scoped.
|
||||
#: *Type: string*
|
||||
domain_id = resource.prop('domain_id')
|
||||
domain_id = resource.Body('domain_id')
|
||||
#: Indicates whether the project also acts as a domain. If set to True,
|
||||
#: the project acts as both a project and a domain. Default is False.
|
||||
#: New in version 3.6
|
||||
is_domain = resource.Body('is_domain', type=bool)
|
||||
#: Setting this attribute to ``False`` prevents users from authorizing
|
||||
#: against this project. Additionally, all pre-existing tokens authorized
|
||||
#: for the project are immediately invalidated. Re-enabling a project
|
||||
#: does not re-enable pre-existing tokens. *Type: bool*
|
||||
is_enabled = resource.prop('enabled', type=bool)
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
#: Unique project name, within the owning domain. *Type: string*
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The ID of the parent of the project.
|
||||
#: New in version 3.4
|
||||
parent_id = resource.Body('parent_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Region(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Region(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,6 +30,8 @@ class Region(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: User-facing description of the region. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: The links for the region resource.
|
||||
links = resource.Body('links')
|
||||
#: ID of parent region, if any. *Type: string*
|
||||
parent_region_id = resource.prop('parent_region_id')
|
||||
parent_region_id = resource.Body('parent_region_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Service(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class Service(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -30,15 +30,17 @@ class Service(resource.Resource):
|
|||
|
||||
# Properties
|
||||
#: User-facing description of the service. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: Setting this value to ``False`` prevents the service and
|
||||
#: its endpoints from appearing in the service catalog. *Type: bool*
|
||||
is_enabled = resource.prop('enabled', type=bool)
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
#: The links for the service resource.
|
||||
links = resource.Body('links')
|
||||
#: User-facing name of the service. *Type: string*
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: Describes the API implemented by the service. The following values are
|
||||
#: recognized within the OpenStack ecosystem: ``compute``, ``image``,
|
||||
#: ``ec2``, ``identity``, ``volume``, ``network``. To support non-core and
|
||||
#: future projects, the value should not be validated against this list.
|
||||
#: *Type: string*
|
||||
type = resource.prop('type')
|
||||
type = resource.Body('type')
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class Trust(resource.Resource):
|
||||
|
@ -23,37 +23,53 @@ class Trust(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_get = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
allow_retrieve = True
|
||||
|
||||
# Properties
|
||||
#: ID of the project upon which the trustor is
|
||||
#: delegating authorization. *Type: string*
|
||||
project_id = resource.prop('project_id')
|
||||
#: A boolean indicating whether the trust can be issued by the trustee as
|
||||
#: a regulart trust. Default is ``False``.
|
||||
allow_redelegation = resource.Body('allow_redelegation', type=bool)
|
||||
#: If ``impersonation`` is set to ``False``, then the token's ``user``
|
||||
#: attribute will represent that of the trustee. *Type: bool*
|
||||
is_impersonation = resource.Body('impersonation', type=bool)
|
||||
#: Specifies the expiration time of the trust. A trust may be revoked
|
||||
#: ahead of expiration. If the value represents a time in the past,
|
||||
#: the trust is deactivated.
|
||||
expires_at = resource.prop('expires_at')
|
||||
#: ID of the trust object. *Type: string*
|
||||
id = resource.prop('id')
|
||||
expires_at = resource.Body('expires_at')
|
||||
#: If ``impersonation`` is set to true, then the ``user`` attribute
|
||||
#: of tokens that are generated based on the trust will represent
|
||||
#: that of the trustor rather than the trustee, thus allowing the trustee
|
||||
#: to impersonate the trustor.
|
||||
#: If ``impersonation`` is set to ``False``, then the token's ``user``
|
||||
#: attribute will represent that of the trustee. *Type: bool*
|
||||
is_impersonation = resource.prop('impersonation', type=bool)
|
||||
#: Represents the user ID who is capable of consuming the trust.
|
||||
#: *Type: string*
|
||||
trustee_user_id = resource.prop('trustee_user_id')
|
||||
#: Represents the user ID who created the trust, and who's authorization is
|
||||
#: being delegated. *Type: string*
|
||||
trustor_user_id = resource.prop('trustor_user_id')
|
||||
is_impersonation = resource.Body('impersonation', type=bool)
|
||||
#: Links for the trust resource.
|
||||
links = resource.Body('links')
|
||||
#: ID of the project upon which the trustor is
|
||||
#: delegating authorization. *Type: string*
|
||||
project_id = resource.Body('project_id')
|
||||
#: A role links object that includes 'next', 'previous', and self links
|
||||
#: for roles.
|
||||
role_links = resource.Body('role_links')
|
||||
#: Specifies the subset of the trustor's roles on the ``project_id``
|
||||
#: to be granted to the trustee when the token in consumed. The
|
||||
#: trustor must already be granted these roles in the project referenced
|
||||
#: by the ``project_id`` attribute. *Type: list*
|
||||
roles = resource.prop('roles')
|
||||
roles = resource.Body('roles')
|
||||
#: Returned with redelegated trust provides information about the
|
||||
#: predecessor in the trust chain.
|
||||
redelegated_trust_id = resource.Body('redelegated_trust_id')
|
||||
#: Redelegation count
|
||||
redelegation_count = resource.prop('redelegation_count')
|
||||
redelegation_count = resource.Body('redelegation_count')
|
||||
#: How many times the trust can be used to obtain a token. The value is
|
||||
#: decreased each time a token is issued through the trust. Once it
|
||||
#: reaches zero, no further tokens will be isued through the trust.
|
||||
remaining_uses = resource.Body('remaining_uses')
|
||||
#: Represents the user ID who is capable of consuming the trust.
|
||||
#: *Type: string*
|
||||
trustee_user_id = resource.Body('trustee_user_id')
|
||||
#: Represents the user ID who created the trust, and who's authorization is
|
||||
#: being delegated. *Type: string*
|
||||
trustor_user_id = resource.Body('trustor_user_id')
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
from openstack.identity import identity_service
|
||||
from openstack import resource
|
||||
from openstack import resource2 as resource
|
||||
|
||||
|
||||
class User(resource.Resource):
|
||||
|
@ -22,7 +22,7 @@ class User(resource.Resource):
|
|||
|
||||
# capabilities
|
||||
allow_create = True
|
||||
allow_retrieve = True
|
||||
allow_get = True
|
||||
allow_update = True
|
||||
allow_delete = True
|
||||
allow_list = True
|
||||
|
@ -39,23 +39,30 @@ class User(resource.Resource):
|
|||
#: *New in version 3.1* If the user does not have authorization to
|
||||
#: their default project, the default project will be ignored at token
|
||||
#: creation. *Type: string*
|
||||
default_project_id = resource.prop('default_project_id')
|
||||
default_project_id = resource.Body('default_project_id')
|
||||
#: The description of this user. *Type: string*
|
||||
description = resource.prop('description')
|
||||
description = resource.Body('description')
|
||||
#: References the domain ID which owns the user; if a domain ID is not
|
||||
#: specified by the client, the Identity service implementation will
|
||||
#: default it to the domain ID to which the client's token is scoped.
|
||||
#: *Type: string*
|
||||
domain_id = resource.prop('domain_id')
|
||||
domain_id = resource.Body('domain_id')
|
||||
#: The email of this user. *Type: string*
|
||||
email = resource.prop('email')
|
||||
email = resource.Body('email')
|
||||
#: Setting this value to ``False`` prevents the user from authenticating or
|
||||
#: receiving authorization. Additionally, all pre-existing tokens held by
|
||||
#: the user are immediately invalidated. Re-enabling a user does not
|
||||
#: re-enable pre-existing tokens. *Type: bool*
|
||||
is_enabled = resource.prop('enabled', type=bool)
|
||||
is_enabled = resource.Body('enabled', type=bool)
|
||||
#: The links for the user resource.
|
||||
links = resource.Body('links')
|
||||
#: Unique user name, within the owning domain. *Type: string*
|
||||
name = resource.prop('name')
|
||||
name = resource.Body('name')
|
||||
#: The default form of credential used during authentication.
|
||||
#: *Type: string*
|
||||
password = resource.prop('password')
|
||||
password = resource.Body('password')
|
||||
#: The date and time when the pasword expires. The time zone is UTC.
|
||||
#: A None value means the password never expires.
|
||||
#: This is a response object attribute, not valid for requests.
|
||||
#: *New in version 3.7*
|
||||
password_expires_at = resource.Body('password_expires_at')
|
||||
|
|
|
@ -33,13 +33,14 @@ class TestCredential(testtools.TestCase):
|
|||
self.assertEqual('/credentials', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = credential.Credential(EXAMPLE)
|
||||
sot = credential.Credential(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['blob'], sot.blob)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['project_id'], sot.project_id)
|
||||
|
|
|
@ -19,6 +19,7 @@ EXAMPLE = {
|
|||
'description': '1',
|
||||
'enabled': True,
|
||||
'id': IDENTIFIER,
|
||||
'links': {'self': 'http://example.com/identity/v3/domains/id'},
|
||||
'name': '4',
|
||||
}
|
||||
|
||||
|
@ -32,14 +33,16 @@ class TestDomain(testtools.TestCase):
|
|||
self.assertEqual('/domains', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = domain.Domain(EXAMPLE)
|
||||
sot = domain.Domain(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertTrue(sot.is_enabled)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
|
|
|
@ -19,6 +19,7 @@ EXAMPLE = {
|
|||
'enabled': True,
|
||||
'id': IDENTIFIER,
|
||||
'interface': '3',
|
||||
'links': {'self': 'http://example.com/endpoint1'},
|
||||
'region_id': '4',
|
||||
'service_id': '5',
|
||||
'url': '6',
|
||||
|
@ -34,16 +35,18 @@ class TestEndpoint(testtools.TestCase):
|
|||
self.assertEqual('/endpoints', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = endpoint.Endpoint(EXAMPLE)
|
||||
sot = endpoint.Endpoint(**EXAMPLE)
|
||||
self.assertTrue(sot.is_enabled)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['interface'], sot.interface)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['region_id'], sot.region_id)
|
||||
self.assertEqual(EXAMPLE['service_id'], sot.service_id)
|
||||
self.assertEqual(EXAMPLE['url'], sot.url)
|
||||
|
|
|
@ -32,13 +32,14 @@ class TestGroup(testtools.TestCase):
|
|||
self.assertEqual('/groups', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = group.Group(EXAMPLE)
|
||||
sot = group.Group(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['domain_id'], sot.domain_id)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
|
|
|
@ -18,7 +18,10 @@ IDENTIFIER = 'IDENTIFIER'
|
|||
EXAMPLE = {
|
||||
'blob': '1',
|
||||
'id': IDENTIFIER,
|
||||
'links': {'self': 'a-pointer'},
|
||||
'project_id': '2',
|
||||
'type': '3',
|
||||
'user_id': '4',
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,13 +34,17 @@ class TestPolicy(testtools.TestCase):
|
|||
self.assertEqual('/policies', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = policy.Policy(EXAMPLE)
|
||||
sot = policy.Policy(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['blob'], sot.blob)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['project_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['type'], sot.type)
|
||||
self.assertEqual(EXAMPLE['user_id'], sot.user_id)
|
||||
|
|
|
@ -20,7 +20,9 @@ EXAMPLE = {
|
|||
'domain_id': '2',
|
||||
'enabled': True,
|
||||
'id': IDENTIFIER,
|
||||
'is_domain': False,
|
||||
'name': '5',
|
||||
'parent_id': '6',
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,15 +35,18 @@ class TestProject(testtools.TestCase):
|
|||
self.assertEqual('/projects', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = project.Project(EXAMPLE)
|
||||
sot = project.Project(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['domain_id'], sot.domain_id)
|
||||
self.assertFalse(sot.is_domain)
|
||||
self.assertTrue(sot.is_enabled)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['parent_id'], sot.parent_id)
|
||||
|
|
|
@ -18,6 +18,7 @@ IDENTIFIER = 'RegionOne'
|
|||
EXAMPLE = {
|
||||
'description': '1',
|
||||
'id': IDENTIFIER,
|
||||
'links': {'self': 'http://example.com/region1'},
|
||||
'parent_region_id': 'FAKE_PARENT',
|
||||
}
|
||||
|
||||
|
@ -31,13 +32,15 @@ class TestRegion(testtools.TestCase):
|
|||
self.assertEqual('/regions', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = region.Region(EXAMPLE)
|
||||
sot = region.Region(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['parent_region_id'], sot.parent_region_id)
|
||||
|
|
|
@ -19,6 +19,7 @@ EXAMPLE = {
|
|||
'description': '1',
|
||||
'enabled': True,
|
||||
'id': IDENTIFIER,
|
||||
'links': {'self': 'http://example.com/service1'},
|
||||
'name': '4',
|
||||
'type': '5',
|
||||
}
|
||||
|
@ -33,15 +34,17 @@ class TestService(testtools.TestCase):
|
|||
self.assertEqual('/services', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = service.Service(EXAMPLE)
|
||||
sot = service.Service(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
self.assertTrue(sot.is_enabled)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['type'], sot.type)
|
||||
|
|
|
@ -16,14 +16,19 @@ from openstack.identity.v3 import trust
|
|||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
||||
'project_id': '1',
|
||||
'allow_redelegation': False,
|
||||
'expires_at': '2016-03-09T12:14:57.233772',
|
||||
'id': IDENTIFIER,
|
||||
'impersonation': True,
|
||||
'links': {'self': 'fake_link'},
|
||||
'project_id': '1',
|
||||
'redelegated_trust_id': None,
|
||||
'redelegation_count': '0',
|
||||
'remaining_uses': 10,
|
||||
'role_links': {'self': 'other_fake_link'},
|
||||
'trustee_user_id': '2',
|
||||
'trustor_user_id': '3',
|
||||
'roles': [{'name': 'test-role'}],
|
||||
'redelegation_count': '0',
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,17 +41,22 @@ class TestTrust(testtools.TestCase):
|
|||
self.assertEqual('/OS-TRUST/trusts', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = trust.Trust(EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['project_id'],
|
||||
sot.project_id)
|
||||
sot = trust.Trust(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['allow_redelegation'], sot.allow_redelegation)
|
||||
self.assertEqual(EXAMPLE['expires_at'], sot.expires_at)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertTrue(sot.is_impersonation)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['project_id'], sot.project_id)
|
||||
self.assertEqual(EXAMPLE['role_links'], sot.role_links)
|
||||
self.assertEqual(EXAMPLE['redelegated_trust_id'],
|
||||
sot.redelegated_trust_id)
|
||||
self.assertEqual(EXAMPLE['remaining_uses'], sot.remaining_uses)
|
||||
self.assertEqual(EXAMPLE['trustee_user_id'], sot.trustee_user_id)
|
||||
self.assertEqual(EXAMPLE['trustor_user_id'], sot.trustor_user_id)
|
||||
self.assertEqual(EXAMPLE['roles'], sot.roles)
|
||||
|
|
|
@ -22,8 +22,10 @@ EXAMPLE = {
|
|||
'email': '4',
|
||||
'enabled': True,
|
||||
'id': IDENTIFIER,
|
||||
'links': {'self': 'http://example.com/user1'},
|
||||
'name': '6',
|
||||
'password': '7',
|
||||
'password_expires_at': '8',
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,13 +38,14 @@ class TestUser(testtools.TestCase):
|
|||
self.assertEqual('/users', sot.base_path)
|
||||
self.assertEqual('identity', sot.service.service_type)
|
||||
self.assertTrue(sot.allow_create)
|
||||
self.assertTrue(sot.allow_retrieve)
|
||||
self.assertTrue(sot.allow_get)
|
||||
self.assertTrue(sot.allow_update)
|
||||
self.assertTrue(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
self.assertTrue(sot.patch_update)
|
||||
|
||||
def test_make_it(self):
|
||||
sot = user.User(EXAMPLE)
|
||||
sot = user.User(**EXAMPLE)
|
||||
self.assertEqual(EXAMPLE['default_project_id'],
|
||||
sot.default_project_id)
|
||||
self.assertEqual(EXAMPLE['description'], sot.description)
|
||||
|
@ -50,5 +53,8 @@ class TestUser(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['email'], sot.email)
|
||||
self.assertTrue(sot.is_enabled)
|
||||
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['password'], sot.password)
|
||||
self.assertEqual(EXAMPLE['password_expires_at'],
|
||||
sot.password_expires_at)
|
||||
|
|
Loading…
Reference in New Issue