summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-08 20:58:20 +0000
committerGerrit Code Review <review@openstack.org>2016-09-08 20:58:20 +0000
commit7d1a5d0854c732681a130255ddc6abb2e9721a7a (patch)
treeee2deba8cfc518b160ecabea22ed5b7223436aa3 /openstackclient
parentb4307b1ef61e957536dd1a77e459a5343c367064 (diff)
parent24c8b94baf4c95cd3a76159009badbc53573be09 (diff)
downloadpython-openstackclient-7d1a5d0854c732681a130255ddc6abb2e9721a7a.tar.gz
Merge "format token expires time to prevent json loading datetime data"
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/identity/v2_0/token.py4
-rw-r--r--openstackclient/identity/v3/token.py4
-rw-r--r--openstackclient/tests/identity/v2_0/fakes.py2
-rw-r--r--openstackclient/tests/identity/v2_0/test_token.py4
-rw-r--r--openstackclient/tests/identity/v3/fakes.py2
-rw-r--r--openstackclient/tests/identity/v3/test_token.py6
6 files changed, 13 insertions, 9 deletions
diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py
index 56f920f3..4b7e988b 100644
--- a/openstackclient/identity/v2_0/token.py
+++ b/openstackclient/identity/v2_0/token.py
@@ -42,7 +42,9 @@ class IssueToken(command.ShowOne):
if auth_ref.auth_token:
data['id'] = auth_ref.auth_token
if auth_ref.expires:
- data['expires'] = auth_ref.expires
+ datetime_obj = auth_ref.expires
+ expires_str = datetime_obj.strftime('%Y-%m-%dT%H:%M:%S%z')
+ data['expires'] = expires_str
if auth_ref.project_id:
data['project_id'] = auth_ref.project_id
if auth_ref.user_id:
diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py
index ecf09693..2cd304e6 100644
--- a/openstackclient/identity/v3/token.py
+++ b/openstackclient/identity/v3/token.py
@@ -183,7 +183,9 @@ class IssueToken(command.ShowOne):
if auth_ref.auth_token:
data['id'] = auth_ref.auth_token
if auth_ref.expires:
- data['expires'] = auth_ref.expires
+ datetime_obj = auth_ref.expires
+ expires_str = datetime_obj.strftime('%Y-%m-%dT%H:%M:%S%z')
+ data['expires'] = expires_str
if auth_ref.project_id:
data['project_id'] = auth_ref.project_id
if auth_ref.user_id:
diff --git a/openstackclient/tests/identity/v2_0/fakes.py b/openstackclient/tests/identity/v2_0/fakes.py
index a715427c..3e0b9993 100644
--- a/openstackclient/tests/identity/v2_0/fakes.py
+++ b/openstackclient/tests/identity/v2_0/fakes.py
@@ -80,7 +80,7 @@ USER = {
'enabled': True,
}
-token_expires = '2014-01-01T00:00:00Z'
+token_expires = '2016-09-05T18:04:52+0000'
token_id = 'token-id-' + uuid.uuid4().hex
TOKEN = {
diff --git a/openstackclient/tests/identity/v2_0/test_token.py b/openstackclient/tests/identity/v2_0/test_token.py
index bb776707..17115e6b 100644
--- a/openstackclient/tests/identity/v2_0/test_token.py
+++ b/openstackclient/tests/identity/v2_0/test_token.py
@@ -58,7 +58,7 @@ class TestTokenIssue(TestToken):
collist = ('expires', 'id', 'project_id', 'user_id')
self.assertEqual(collist, columns)
datalist = (
- auth_ref.expires,
+ identity_fakes.token_expires,
identity_fakes.token_id,
'project-id',
'user-id',
@@ -86,7 +86,7 @@ class TestTokenIssue(TestToken):
)
self.assertEqual(collist, columns)
datalist = (
- auth_ref.expires,
+ identity_fakes.token_expires,
identity_fakes.token_id,
'user-id',
)
diff --git a/openstackclient/tests/identity/v3/fakes.py b/openstackclient/tests/identity/v3/fakes.py
index c4d24d46..38f6724e 100644
--- a/openstackclient/tests/identity/v3/fakes.py
+++ b/openstackclient/tests/identity/v3/fakes.py
@@ -252,7 +252,7 @@ TRUST = {
'trustor_user_id': user_id,
}
-token_expires = '2014-01-01T00:00:00Z'
+token_expires = '2016-09-05T18:04:52+0000'
token_id = 'tttttttt-tttt-tttt-tttt-tttttttttttt'
UNSCOPED_TOKEN = {
diff --git a/openstackclient/tests/identity/v3/test_token.py b/openstackclient/tests/identity/v3/test_token.py
index 9728c6e1..d7225e6c 100644
--- a/openstackclient/tests/identity/v3/test_token.py
+++ b/openstackclient/tests/identity/v3/test_token.py
@@ -55,7 +55,7 @@ class TestTokenIssue(TestToken):
collist = ('expires', 'id', 'project_id', 'user_id')
self.assertEqual(collist, columns)
datalist = (
- auth_ref.expires,
+ identity_fakes.token_expires,
identity_fakes.token_id,
identity_fakes.project_id,
identity_fakes.user_id,
@@ -82,7 +82,7 @@ class TestTokenIssue(TestToken):
self.assertEqual(collist, columns)
datalist = (
identity_fakes.domain_id,
- auth_ref.expires,
+ identity_fakes.token_expires,
identity_fakes.token_id,
identity_fakes.user_id,
)
@@ -109,7 +109,7 @@ class TestTokenIssue(TestToken):
)
self.assertEqual(collist, columns)
datalist = (
- auth_ref.expires,
+ identity_fakes.token_expires,
identity_fakes.token_id,
identity_fakes.user_id,
)