summaryrefslogtreecommitdiff
path: root/keystoneclient
diff options
context:
space:
mode:
Diffstat (limited to 'keystoneclient')
-rw-r--r--keystoneclient/auth/identity/v3/base.py4
-rw-r--r--keystoneclient/common/cms.py3
-rw-r--r--keystoneclient/tests/unit/auth/test_identity_v2.py2
-rw-r--r--keystoneclient/tests/unit/auth/test_identity_v3.py2
-rw-r--r--keystoneclient/tests/unit/client_fixtures.py28
-rw-r--r--keystoneclient/tests/unit/test_discovery.py4
-rw-r--r--keystoneclient/tests/unit/v2_0/test_auth.py4
-rw-r--r--keystoneclient/tests/unit/v2_0/test_client.py11
-rw-r--r--keystoneclient/tests/unit/v3/test_auth.py2
-rw-r--r--keystoneclient/tests/unit/v3/test_client.py10
10 files changed, 36 insertions, 34 deletions
diff --git a/keystoneclient/auth/identity/v3/base.py b/keystoneclient/auth/identity/v3/base.py
index 51d16ea..33f354e 100644
--- a/keystoneclient/auth/identity/v3/base.py
+++ b/keystoneclient/auth/identity/v3/base.py
@@ -11,10 +11,10 @@
# under the License.
import abc
-import json
import logging
from oslo_config import cfg
+from oslo_serialization import jsonutils
import six
from keystoneclient import access
@@ -189,7 +189,7 @@ class Auth(BaseAuth):
authenticated=False, log=False, **rkwargs)
try:
- _logger.debug(json.dumps(resp.json()))
+ _logger.debug(jsonutils.dumps(resp.json()))
resp_data = resp.json()['token']
except (KeyError, ValueError):
raise exceptions.InvalidResponse(response=resp)
diff --git a/keystoneclient/common/cms.py b/keystoneclient/common/cms.py
index 9c3e0bd..abd6ef6 100644
--- a/keystoneclient/common/cms.py
+++ b/keystoneclient/common/cms.py
@@ -38,7 +38,8 @@ PKI_ASN1_PREFIX = 'MII'
PKIZ_PREFIX = 'PKIZ_'
PKIZ_CMS_FORM = 'DER'
PKI_ASN1_FORM = 'PEM'
-DEFAULT_TOKEN_DIGEST_ALGORITHM = 'sha256'
+# Adding nosec since this fails bandit B105, 'Possible hardcoded password'.
+DEFAULT_TOKEN_DIGEST_ALGORITHM = 'sha256' # nosec
# The openssl cms command exits with these status codes.
diff --git a/keystoneclient/tests/unit/auth/test_identity_v2.py b/keystoneclient/tests/unit/auth/test_identity_v2.py
index 8ef87c4..a180135 100644
--- a/keystoneclient/tests/unit/auth/test_identity_v2.py
+++ b/keystoneclient/tests/unit/auth/test_identity_v2.py
@@ -84,7 +84,7 @@ class V2IdentityPlugin(utils.TestCase):
self.TEST_RESPONSE_DICT = {
"access": {
"token": {
- "expires": "2020-01-01T00:00:10.000123Z",
+ "expires": "2999-01-01T00:00:10.000123Z",
"id": self.TEST_TOKEN,
"tenant": {
"id": self.TEST_TENANT_ID
diff --git a/keystoneclient/tests/unit/auth/test_identity_v3.py b/keystoneclient/tests/unit/auth/test_identity_v3.py
index 534e997..776551b 100644
--- a/keystoneclient/tests/unit/auth/test_identity_v3.py
+++ b/keystoneclient/tests/unit/auth/test_identity_v3.py
@@ -129,7 +129,7 @@ class V3IdentityPlugin(utils.TestCase):
"password"
],
- "expires_at": "2020-01-01T00:00:10.000123Z",
+ "expires_at": "2999-01-01T00:00:10.000123Z",
"project": {
"domain": {
"id": self.TEST_DOMAIN_ID,
diff --git a/keystoneclient/tests/unit/client_fixtures.py b/keystoneclient/tests/unit/client_fixtures.py
index 6da259c..cc07726 100644
--- a/keystoneclient/tests/unit/client_fixtures.py
+++ b/keystoneclient/tests/unit/client_fixtures.py
@@ -399,7 +399,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': self.UUID_TOKEN_DEFAULT,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
'tenant': {
'id': 'tenant_id1',
'name': 'tenant_name1',
@@ -420,7 +420,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': self.VALID_DIABLO_TOKEN,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
'tenantId': 'tenant_id1',
},
'user': {
@@ -437,7 +437,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': self.UUID_TOKEN_UNSCOPED,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
},
'user': {
'id': 'user_id1',
@@ -453,7 +453,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': 'valid-token',
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
'tenant': {
'id': 'tenant_id1',
'name': 'tenant_name1',
@@ -474,7 +474,7 @@ class Examples(fixtures.Fixture):
'token': {
'bind': {'kerberos': self.KERBEROS_BIND},
'id': self.UUID_TOKEN_BIND,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
'tenant': {
'id': 'tenant_id1',
'name': 'tenant_name1',
@@ -496,7 +496,7 @@ class Examples(fixtures.Fixture):
'token': {
'bind': {'FOO': 'BAR'},
'id': self.UUID_TOKEN_UNKNOWN_BIND,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
'tenant': {
'id': 'tenant_id1',
'name': 'tenant_name1',
@@ -515,7 +515,7 @@ class Examples(fixtures.Fixture):
},
self.v3_UUID_TOKEN_DEFAULT: {
'token': {
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'methods': ['password'],
'user': {
'id': 'user_id1',
@@ -542,7 +542,7 @@ class Examples(fixtures.Fixture):
},
self.v3_UUID_TOKEN_UNSCOPED: {
'token': {
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'methods': ['password'],
'user': {
'id': 'user_id1',
@@ -556,7 +556,7 @@ class Examples(fixtures.Fixture):
},
self.v3_UUID_TOKEN_DOMAIN_SCOPED: {
'token': {
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'methods': ['password'],
'user': {
'id': 'user_id1',
@@ -581,7 +581,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': self.SIGNED_TOKEN_SCOPED_KEY,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
},
'user': {
'id': 'user_id1',
@@ -599,7 +599,7 @@ class Examples(fixtures.Fixture):
'access': {
'token': {
'id': self.SIGNED_TOKEN_UNSCOPED_KEY,
- 'expires': '2020-01-01T00:00:10.000123Z',
+ 'expires': '2999-01-01T00:00:10.000123Z',
},
'user': {
'id': 'user_id1',
@@ -613,7 +613,7 @@ class Examples(fixtures.Fixture):
},
self.SIGNED_v3_TOKEN_SCOPED_KEY: {
'token': {
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'methods': ['password'],
'user': {
'id': 'user_id1',
@@ -642,7 +642,7 @@ class Examples(fixtures.Fixture):
'token': {
'bind': {'kerberos': self.KERBEROS_BIND},
'methods': ['password'],
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'user': {
'id': 'user_id1',
'name': 'user_name1',
@@ -669,7 +669,7 @@ class Examples(fixtures.Fixture):
self.v3_UUID_TOKEN_UNKNOWN_BIND: {
'token': {
'bind': {'FOO': 'BAR'},
- 'expires_at': '2020-01-01T00:00:10.000123Z',
+ 'expires_at': '2999-01-01T00:00:10.000123Z',
'methods': ['password'],
'user': {
'id': 'user_id1',
diff --git a/keystoneclient/tests/unit/test_discovery.py b/keystoneclient/tests/unit/test_discovery.py
index f9d5dbf..6f85ea9 100644
--- a/keystoneclient/tests/unit/test_discovery.py
+++ b/keystoneclient/tests/unit/test_discovery.py
@@ -87,7 +87,7 @@ V2_VERSION.updated_str = UPDATED
V2_AUTH_RESPONSE = jsonutils.dumps({
"access": {
"token": {
- "expires": "2020-01-01T00:00:10.000123Z",
+ "expires": "2999-01-01T00:00:10.000123Z",
"id": 'fakeToken',
"tenant": {
"id": '1'
@@ -113,7 +113,7 @@ V3_AUTH_RESPONSE = jsonutils.dumps({
"password"
],
- "expires_at": "2020-01-01T00:00:10.000123Z",
+ "expires_at": "2999-01-01T00:00:10.000123Z",
"project": {
"domain": {
"id": '1',
diff --git a/keystoneclient/tests/unit/v2_0/test_auth.py b/keystoneclient/tests/unit/v2_0/test_auth.py
index 64f2ea0..b733524 100644
--- a/keystoneclient/tests/unit/v2_0/test_auth.py
+++ b/keystoneclient/tests/unit/v2_0/test_auth.py
@@ -28,7 +28,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.TEST_RESPONSE_DICT = {
"access": {
"token": {
- "expires": "2020-01-01T00:00:10.000123Z",
+ "expires": "2999-01-01T00:00:10.000123Z",
"id": self.TEST_TOKEN,
"tenant": {
"id": self.TEST_TENANT_ID
@@ -61,7 +61,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
# Build a new response
TEST_TOKEN = "abcdef"
- resp_b['access']['token']['expires'] = '2020-01-01T00:00:10.000123Z'
+ resp_b['access']['token']['expires'] = '2999-01-01T00:00:10.000123Z'
resp_b['access']['token']['id'] = TEST_TOKEN
# return expired first, and then the new response
diff --git a/keystoneclient/tests/unit/v2_0/test_client.py b/keystoneclient/tests/unit/v2_0/test_client.py
index cddac4d..7fe9b18 100644
--- a/keystoneclient/tests/unit/v2_0/test_client.py
+++ b/keystoneclient/tests/unit/v2_0/test_client.py
@@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-import json
import uuid
+from oslo_serialization import jsonutils
+
from keystoneauth1 import fixture
from keystoneauth1 import session as auth_session
@@ -75,10 +76,10 @@ class KeystoneClientTest(utils.TestCase):
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
- cache = json.dumps(cl.auth_ref)
+ cache = jsonutils.dumps(cl.auth_ref)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
- new_client = client.Client(auth_ref=json.loads(cache))
+ new_client = client.Client(auth_ref=jsonutils.loads(cache))
self.assertIsNotNone(new_client.auth_ref)
with self.deprecations.expect_deprecations_here():
self.assertTrue(new_client.auth_ref.scoped)
@@ -100,11 +101,11 @@ class KeystoneClientTest(utils.TestCase):
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
- cache = json.dumps(cl.auth_ref)
+ cache = jsonutils.dumps(cl.auth_ref)
new_auth_url = "http://new-public:5000/v2.0"
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
- new_client = client.Client(auth_ref=json.loads(cache),
+ new_client = client.Client(auth_ref=jsonutils.loads(cache),
auth_url=new_auth_url)
self.assertIsNotNone(new_client.auth_ref)
with self.deprecations.expect_deprecations_here():
diff --git a/keystoneclient/tests/unit/v3/test_auth.py b/keystoneclient/tests/unit/v3/test_auth.py
index 6549080..9f87977 100644
--- a/keystoneclient/tests/unit/v3/test_auth.py
+++ b/keystoneclient/tests/unit/v3/test_auth.py
@@ -28,7 +28,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
"password"
],
- "expires_at": "2020-01-01T00:00:10.000123Z",
+ "expires_at": "2999-01-01T00:00:10.000123Z",
"project": {
"domain": {
"id": self.TEST_DOMAIN_ID,
diff --git a/keystoneclient/tests/unit/v3/test_client.py b/keystoneclient/tests/unit/v3/test_client.py
index feb921a..82088fd 100644
--- a/keystoneclient/tests/unit/v3/test_client.py
+++ b/keystoneclient/tests/unit/v3/test_client.py
@@ -11,9 +11,9 @@
# under the License.
import copy
-import json
import uuid
+from oslo_serialization import jsonutils
from keystoneauth1 import session as auth_session
from keystoneclient.auth import token_endpoint
@@ -90,10 +90,10 @@ class KeystoneClientTest(utils.TestCase):
password='password',
project_id=token.project_id,
auth_url=self.TEST_URL)
- cache = json.dumps(c.auth_ref)
+ cache = jsonutils.dumps(c.auth_ref)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
- new_client = client.Client(auth_ref=json.loads(cache))
+ new_client = client.Client(auth_ref=jsonutils.loads(cache))
self.assertIsNotNone(new_client.auth_ref)
self.assertFalse(new_client.auth_ref.domain_scoped)
self.assertTrue(new_client.auth_ref.project_scoped)
@@ -124,10 +124,10 @@ class KeystoneClientTest(utils.TestCase):
password='password',
project_id=project_id,
auth_url=self.TEST_URL)
- cache = json.dumps(c.auth_ref)
+ cache = jsonutils.dumps(c.auth_ref)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
- new_client = client.Client(auth_ref=json.loads(cache),
+ new_client = client.Client(auth_ref=jsonutils.loads(cache),
auth_url=new_auth_url)
self.assertIsNotNone(new_client.auth_ref)
self.assertFalse(new_client.auth_ref.domain_scoped)