From 4063801c86ec597210fa14b0974709d27279d51e Mon Sep 17 00:00:00 2001 From: tengqm Date: Sun, 4 Sep 2016 03:34:47 -0400 Subject: [PATCH] Rebase keystone resources onto resource2 This patch also added some fields that were missing. Change-Id: I017261de2eba8980f7a4b578d51b0faccbd5042a --- openstack/identity/v3/credential.py | 12 ++--- openstack/identity/v3/domain.py | 12 +++-- openstack/identity/v3/endpoint.py | 16 +++--- openstack/identity/v3/group.py | 10 ++-- openstack/identity/v3/policy.py | 14 ++++-- openstack/identity/v3/project.py | 19 ++++--- openstack/identity/v3/region.py | 10 ++-- openstack/identity/v3/service.py | 14 +++--- openstack/identity/v3/trust.py | 50 ++++++++++++------- openstack/identity/v3/user.py | 25 ++++++---- .../tests/unit/identity/v3/test_credential.py | 5 +- .../tests/unit/identity/v3/test_domain.py | 7 ++- .../tests/unit/identity/v3/test_endpoint.py | 7 ++- .../tests/unit/identity/v3/test_group.py | 5 +- .../tests/unit/identity/v3/test_policy.py | 11 +++- .../tests/unit/identity/v3/test_project.py | 9 +++- .../tests/unit/identity/v3/test_region.py | 7 ++- .../tests/unit/identity/v3/test_service.py | 7 ++- .../tests/unit/identity/v3/test_trust.py | 22 +++++--- openstack/tests/unit/identity/v3/test_user.py | 10 +++- 20 files changed, 179 insertions(+), 93 deletions(-) diff --git a/openstack/identity/v3/credential.py b/openstack/identity/v3/credential.py index 9a25f889c..e49209979 100644 --- a/openstack/identity/v3/credential.py +++ b/openstack/identity/v3/credential.py @@ -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') diff --git a/openstack/identity/v3/domain.py b/openstack/identity/v3/domain.py index 69228a5dc..b7f330ad9 100644 --- a/openstack/identity/v3/domain.py +++ b/openstack/identity/v3/domain.py @@ -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') diff --git a/openstack/identity/v3/endpoint.py b/openstack/identity/v3/endpoint.py index 46d340f54..a088f7de8 100644 --- a/openstack/identity/v3/endpoint.py +++ b/openstack/identity/v3/endpoint.py @@ -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') diff --git a/openstack/identity/v3/group.py b/openstack/identity/v3/group.py index 1769bb66e..b47c8cfd2 100644 --- a/openstack/identity/v3/group.py +++ b/openstack/identity/v3/group.py @@ -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') diff --git a/openstack/identity/v3/policy.py b/openstack/identity/v3/policy.py index e166bdd9c..bd814d5ba 100644 --- a/openstack/identity/v3/policy.py +++ b/openstack/identity/v3/policy.py @@ -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') diff --git a/openstack/identity/v3/project.py b/openstack/identity/v3/project.py index 0723ef5dd..439962a32 100644 --- a/openstack/identity/v3/project.py +++ b/openstack/identity/v3/project.py @@ -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') diff --git a/openstack/identity/v3/region.py b/openstack/identity/v3/region.py index 281c1678a..1fdd1c20c 100644 --- a/openstack/identity/v3/region.py +++ b/openstack/identity/v3/region.py @@ -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') diff --git a/openstack/identity/v3/service.py b/openstack/identity/v3/service.py index bcf057a49..4eb7c13ca 100644 --- a/openstack/identity/v3/service.py +++ b/openstack/identity/v3/service.py @@ -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') diff --git a/openstack/identity/v3/trust.py b/openstack/identity/v3/trust.py index 3c697bd72..7d0659ad9 100644 --- a/openstack/identity/v3/trust.py +++ b/openstack/identity/v3/trust.py @@ -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') diff --git a/openstack/identity/v3/user.py b/openstack/identity/v3/user.py index 7b031bd30..17f980894 100644 --- a/openstack/identity/v3/user.py +++ b/openstack/identity/v3/user.py @@ -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') diff --git a/openstack/tests/unit/identity/v3/test_credential.py b/openstack/tests/unit/identity/v3/test_credential.py index 01aa61c8f..36066d9cd 100644 --- a/openstack/tests/unit/identity/v3/test_credential.py +++ b/openstack/tests/unit/identity/v3/test_credential.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_domain.py b/openstack/tests/unit/identity/v3/test_domain.py index 4267ffb39..07faa7fe5 100644 --- a/openstack/tests/unit/identity/v3/test_domain.py +++ b/openstack/tests/unit/identity/v3/test_domain.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_endpoint.py b/openstack/tests/unit/identity/v3/test_endpoint.py index 147f7774b..44af71621 100644 --- a/openstack/tests/unit/identity/v3/test_endpoint.py +++ b/openstack/tests/unit/identity/v3/test_endpoint.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_group.py b/openstack/tests/unit/identity/v3/test_group.py index 73bc1d579..ff30c971e 100644 --- a/openstack/tests/unit/identity/v3/test_group.py +++ b/openstack/tests/unit/identity/v3/test_group.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_policy.py b/openstack/tests/unit/identity/v3/test_policy.py index 1edb05014..cdd8b71dc 100644 --- a/openstack/tests/unit/identity/v3/test_policy.py +++ b/openstack/tests/unit/identity/v3/test_policy.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_project.py b/openstack/tests/unit/identity/v3/test_project.py index eaf0f9f7e..f88a0ae5e 100644 --- a/openstack/tests/unit/identity/v3/test_project.py +++ b/openstack/tests/unit/identity/v3/test_project.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_region.py b/openstack/tests/unit/identity/v3/test_region.py index 1bac26a22..01711d0ea 100644 --- a/openstack/tests/unit/identity/v3/test_region.py +++ b/openstack/tests/unit/identity/v3/test_region.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_service.py b/openstack/tests/unit/identity/v3/test_service.py index 09204eedb..848c847f4 100644 --- a/openstack/tests/unit/identity/v3/test_service.py +++ b/openstack/tests/unit/identity/v3/test_service.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_trust.py b/openstack/tests/unit/identity/v3/test_trust.py index 93d1d8992..de5c07c6c 100644 --- a/openstack/tests/unit/identity/v3/test_trust.py +++ b/openstack/tests/unit/identity/v3/test_trust.py @@ -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) diff --git a/openstack/tests/unit/identity/v3/test_user.py b/openstack/tests/unit/identity/v3/test_user.py index 7feefe6bc..f0202b901 100644 --- a/openstack/tests/unit/identity/v3/test_user.py +++ b/openstack/tests/unit/identity/v3/test_user.py @@ -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)