diff --git a/openstack/identity/v2/extension.py b/openstack/identity/v2/extension.py index cfeb3204..77fc4079 100644 --- a/openstack/identity/v2/extension.py +++ b/openstack/identity/v2/extension.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from openstack import format from openstack.identity import identity_service from openstack import resource @@ -41,8 +42,8 @@ class Extension(resource.Resource): #: *Type: string* namespace = resource.prop('namespace') #: The last time the extension has been modified (update date). - #: *Type: date* - updated = resource.prop('updated') + #: *Type: datetime object parsed from ISO 8601 formatted string* + updated_at = resource.prop('updated', type=format.ISO8601) @classmethod def list(cls, session, **params): diff --git a/openstack/identity/v2/role.py b/openstack/identity/v2/role.py index 73103040..536b1928 100644 --- a/openstack/identity/v2/role.py +++ b/openstack/identity/v2/role.py @@ -31,8 +31,8 @@ class Role(resource.Resource): # Properties #: The description of the role. *Type: string* description = resource.prop('description') + #: Setting this attribute to ``False`` prevents this role from being + #: available in the role list. *Type: bool* + is_enabled = resource.prop('enabled', type=format.BoolStr) #: Unique role name. *Type: string* name = resource.prop('name') - #: Setting this attribute to ``False`` prevents this role from being - #: available in the role list. - enabled = resource.prop('enabled', type=format.BoolStr) diff --git a/openstack/identity/v2/tenant.py b/openstack/identity/v2/tenant.py index a75844ee..93630c99 100644 --- a/openstack/identity/v2/tenant.py +++ b/openstack/identity/v2/tenant.py @@ -34,6 +34,6 @@ class Tenant(resource.Resource): #: against this tenant. Additionally, all pre-existing tokens authorized #: for the tenant are immediately invalidated. Re-enabling a tenant #: does not re-enable pre-existing tokens. *Type: bool* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: Unique tenant name. *Type: string* name = resource.prop('name') diff --git a/openstack/identity/v2/user.py b/openstack/identity/v2/user.py index 193d1f4d..930494c9 100644 --- a/openstack/identity/v2/user.py +++ b/openstack/identity/v2/user.py @@ -34,6 +34,6 @@ class User(resource.Resource): #: 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* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: The name of this user. *Type: string* name = resource.prop('name') diff --git a/openstack/identity/v3/domain.py b/openstack/identity/v3/domain.py index bd7c0fd0..69228a5d 100644 --- a/openstack/identity/v3/domain.py +++ b/openstack/identity/v3/domain.py @@ -38,6 +38,6 @@ class Domain(resource.Resource): #: to the above entities are immediately invalidated. #: Re-enabling a domain does not re-enable pre-existing tokens. #: *Type: bool* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: The globally unique name of this domain. *Type: string* name = resource.prop('name') diff --git a/openstack/identity/v3/endpoint.py b/openstack/identity/v3/endpoint.py index 685ab5a1..46d340f5 100644 --- a/openstack/identity/v3/endpoint.py +++ b/openstack/identity/v3/endpoint.py @@ -29,9 +29,6 @@ class Endpoint(resource.Resource): patch_update = True # Properties - #: Setting this value to ``False`` prevents the endpoint from appearing - #: in the service catalog. *Type: bool* - enabled = resource.prop('enabled', type=bool) #: Describes the interface of the endpoint according to one of the #: following values: #: @@ -44,6 +41,9 @@ class Endpoint(resource.Resource): #: #: *Type: string* interface = resource.prop('interface') + #: Setting this value to ``False`` prevents the endpoint from appearing + #: in the service catalog. *Type: bool* + is_enabled = resource.prop('enabled', type=bool) #: Represents the containing region ID of the service endpoint. #: *New in v3.2* *Type: string* region_id = resource.prop('region_id') diff --git a/openstack/identity/v3/project.py b/openstack/identity/v3/project.py index d8a25502..0723ef5d 100644 --- a/openstack/identity/v3/project.py +++ b/openstack/identity/v3/project.py @@ -40,6 +40,6 @@ class Project(resource.Resource): #: 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* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: Unique project name, within the owning domain. *Type: string* name = resource.prop('name') diff --git a/openstack/identity/v3/service.py b/openstack/identity/v3/service.py index 7f814014..bcf057a4 100644 --- a/openstack/identity/v3/service.py +++ b/openstack/identity/v3/service.py @@ -33,7 +33,7 @@ class Service(resource.Resource): description = resource.prop('description') #: Setting this value to ``False`` prevents the service and #: its endpoints from appearing in the service catalog. *Type: bool* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: User-facing name of the service. *Type: string* name = resource.prop('name') #: Describes the API implemented by the service. The following values are diff --git a/openstack/identity/v3/trust.py b/openstack/identity/v3/trust.py index d2dcd8fd..750b37f1 100644 --- a/openstack/identity/v3/trust.py +++ b/openstack/identity/v3/trust.py @@ -11,6 +11,7 @@ # under the License. +from openstack import format from openstack.identity import identity_service from openstack import resource @@ -33,8 +34,9 @@ class Trust(resource.Resource): project_id = resource.prop('project_id') #: 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. *Type: string* - expires_at = resource.prop('expires_at') + #: the trust is deactivated. + #: *Type: datetime object parsed from ISO 8601 formatted string* + expires_at = resource.prop('expires_at', type=format.ISO8601) #: ID of the trust object. *Type: string* id = resource.prop('id') #: If ``impersonation`` is set to true, then the ``user`` attribute @@ -42,8 +44,8 @@ class Trust(resource.Resource): #: 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: boolean* - impersonation = resource.prop('impersonation') + #: 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') diff --git a/openstack/identity/v3/user.py b/openstack/identity/v3/user.py index a01d1afa..7b031bd3 100644 --- a/openstack/identity/v3/user.py +++ b/openstack/identity/v3/user.py @@ -53,7 +53,7 @@ class User(resource.Resource): #: 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* - enabled = resource.prop('enabled', type=bool) + is_enabled = resource.prop('enabled', type=bool) #: Unique user name, within the owning domain. *Type: string* name = resource.prop('name') #: The default form of credential used during authentication. diff --git a/openstack/tests/unit/identity/v2/test_extension.py b/openstack/tests/unit/identity/v2/test_extension.py index a515eaf3..1eceba81 100644 --- a/openstack/tests/unit/identity/v2/test_extension.py +++ b/openstack/tests/unit/identity/v2/test_extension.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime + import mock import testtools @@ -22,7 +24,7 @@ EXAMPLE = { 'links': '3', 'name': '4', 'namespace': '5', - 'updated': '6', + 'updated': '2015-03-09T12:14:57.233772', } @@ -47,7 +49,9 @@ class TestExtension(testtools.TestCase): self.assertEqual(EXAMPLE['links'], sot.links) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['namespace'], sot.namespace) - self.assertEqual(EXAMPLE['updated'], sot.updated) + dt = datetime.datetime(2015, 3, 9, 12, 14, 57, 233772).replace( + tzinfo=None) + self.assertEqual(dt, sot.updated_at.replace(tzinfo=None)) def test_list(self): resp = mock.Mock() diff --git a/openstack/tests/unit/identity/v2/test_role.py b/openstack/tests/unit/identity/v2/test_role.py index 22cca938..55967c25 100644 --- a/openstack/tests/unit/identity/v2/test_role.py +++ b/openstack/tests/unit/identity/v2/test_role.py @@ -43,3 +43,4 @@ class TestRole(testtools.TestCase): self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) + self.assertTrue(sot.is_enabled) diff --git a/openstack/tests/unit/identity/v2/test_tenant.py b/openstack/tests/unit/identity/v2/test_tenant.py index 4669a485..3430284b 100644 --- a/openstack/tests/unit/identity/v2/test_tenant.py +++ b/openstack/tests/unit/identity/v2/test_tenant.py @@ -40,6 +40,6 @@ class TestTenant(testtools.TestCase): def test_make_it(self): sot = tenant.Tenant(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) diff --git a/openstack/tests/unit/identity/v2/test_user.py b/openstack/tests/unit/identity/v2/test_user.py index 2931fb1d..d6ec1ee3 100644 --- a/openstack/tests/unit/identity/v2/test_user.py +++ b/openstack/tests/unit/identity/v2/test_user.py @@ -40,6 +40,6 @@ class TestUser(testtools.TestCase): def test_make_it(self): sot = user.User(EXAMPLE) self.assertEqual(EXAMPLE['email'], sot.email) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) diff --git a/openstack/tests/unit/identity/v3/test_domain.py b/openstack/tests/unit/identity/v3/test_domain.py index 767e6cf8..4267ffb3 100644 --- a/openstack/tests/unit/identity/v3/test_domain.py +++ b/openstack/tests/unit/identity/v3/test_domain.py @@ -40,6 +40,6 @@ class TestDomain(testtools.TestCase): def test_make_it(self): sot = domain.Domain(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) 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 e04cebb3..147f7774 100644 --- a/openstack/tests/unit/identity/v3/test_endpoint.py +++ b/openstack/tests/unit/identity/v3/test_endpoint.py @@ -41,7 +41,7 @@ class TestEndpoint(testtools.TestCase): def test_make_it(self): sot = endpoint.Endpoint(EXAMPLE) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['interface'], sot.interface) self.assertEqual(EXAMPLE['region_id'], sot.region_id) diff --git a/openstack/tests/unit/identity/v3/test_project.py b/openstack/tests/unit/identity/v3/test_project.py index af0921ce..eaf0f9f7 100644 --- a/openstack/tests/unit/identity/v3/test_project.py +++ b/openstack/tests/unit/identity/v3/test_project.py @@ -42,6 +42,6 @@ class TestProject(testtools.TestCase): sot = project.Project(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['domain_id'], sot.domain_id) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) diff --git a/openstack/tests/unit/identity/v3/test_service.py b/openstack/tests/unit/identity/v3/test_service.py index a9ffebca..09204eed 100644 --- a/openstack/tests/unit/identity/v3/test_service.py +++ b/openstack/tests/unit/identity/v3/test_service.py @@ -41,7 +41,7 @@ class TestService(testtools.TestCase): def test_make_it(self): sot = service.Service(EXAMPLE) self.assertEqual(EXAMPLE['description'], sot.description) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) 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 62b17ccc..cafe41fb 100644 --- a/openstack/tests/unit/identity/v3/test_trust.py +++ b/openstack/tests/unit/identity/v3/test_trust.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import datetime + import testtools from openstack.identity.v3 import trust @@ -17,7 +19,7 @@ from openstack.identity.v3 import trust IDENTIFIER = 'IDENTIFIER' EXAMPLE = { 'project_id': '1', - 'expires_at': '2020-01-01T18:30:59.999999Z', + 'expires_at': '2016-03-09T12:14:57.233772', 'id': IDENTIFIER, 'impersonation': True, 'trustee_user_id': '2', @@ -44,9 +46,11 @@ class TestTrust(testtools.TestCase): sot = trust.Trust(EXAMPLE) self.assertEqual(EXAMPLE['project_id'], sot.project_id) - self.assertEqual(EXAMPLE['expires_at'], sot.expires_at) + dt = datetime.datetime(2016, 3, 9, 12, 14, 57, 233772).replace( + tzinfo=None) + self.assertEqual(dt, sot.expires_at.replace(tzinfo=None)) self.assertEqual(EXAMPLE['id'], sot.id) - self.assertEqual(EXAMPLE['impersonation'], sot.impersonation) + self.assertTrue(sot.is_impersonation) 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 23f9e7a7..7feefe6b 100644 --- a/openstack/tests/unit/identity/v3/test_user.py +++ b/openstack/tests/unit/identity/v3/test_user.py @@ -48,7 +48,7 @@ class TestUser(testtools.TestCase): self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['domain_id'], sot.domain_id) self.assertEqual(EXAMPLE['email'], sot.email) - self.assertEqual(EXAMPLE['enabled'], sot.enabled) + self.assertTrue(sot.is_enabled) self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['password'], sot.password)