Make tests pass in 2020

This issue was found while working on reproducible builds for openSUSE.

This solves it similar to change I73bde68be53afff4e8dff12d756b8381f34b2adb

Changed month to February to avoid races around new year.

NOTE: in addition to the orginal backport, this patch also fix bandit
complains. Since 'access_token' literal is not an actual token, we can
safely mark it as false positive so bandit can stop chirping.

Change-Id: I2a28f3f4eaabaa772df395f3f5d55b6fd78f8968
(cherry picked from commit 4461358098)
This commit is contained in:
Bernhard M. Wiedemann 2019-09-09 21:00:14 +02:00 committed by guang-yee
parent aafd91be37
commit 7514ce95bb
3 changed files with 10 additions and 6 deletions

View File

@ -287,7 +287,7 @@ class OidcPassword(_OidcBase):
grant_type = "password" grant_type = "password"
def __init__(self, auth_url, identity_provider, protocol, def __init__(self, auth_url, identity_provider, protocol, # nosec
client_id, client_secret, client_id, client_secret,
access_token_endpoint=None, access_token_endpoint=None,
discovery_endpoint=None, discovery_endpoint=None,
@ -335,7 +335,7 @@ class OidcClientCredentials(_OidcBase):
grant_type = 'client_credentials' grant_type = 'client_credentials'
def __init__(self, auth_url, identity_provider, protocol, def __init__(self, auth_url, identity_provider, protocol, # nosec
client_id, client_secret, client_id, client_secret,
access_token_endpoint=None, access_token_endpoint=None,
discovery_endpoint=None, discovery_endpoint=None,
@ -378,7 +378,7 @@ class OidcAuthorizationCode(_OidcBase):
grant_type = 'authorization_code' grant_type = 'authorization_code'
def __init__(self, auth_url, identity_provider, protocol, def __init__(self, auth_url, identity_provider, protocol, # nosec
client_id, client_secret, client_id, client_secret,
access_token_endpoint=None, access_token_endpoint=None,
discovery_endpoint=None, discovery_endpoint=None,

View File

@ -12,6 +12,7 @@
import copy import copy
import json import json
import time
import uuid import uuid
from keystoneauth1 import _utils as ksa_utils from keystoneauth1 import _utils as ksa_utils
@ -84,7 +85,8 @@ class V2IdentityPlugin(utils.TestCase):
self.TEST_RESPONSE_DICT = { self.TEST_RESPONSE_DICT = {
"access": { "access": {
"token": { "token": {
"expires": "2020-01-01T00:00:10.000123Z", "expires": "%i-02-01T00:00:10.000123Z" %
(1 + time.gmtime().tm_year),
"id": self.TEST_TOKEN, "id": self.TEST_TOKEN,
"tenant": { "tenant": {
"id": self.TEST_TENANT_ID "id": self.TEST_TENANT_ID

View File

@ -12,6 +12,7 @@
import copy import copy
import json import json
import time
import uuid import uuid
from keystoneauth1 import _utils as ksa_utils from keystoneauth1 import _utils as ksa_utils
@ -135,6 +136,7 @@ class V3IdentityPlugin(utils.TestCase):
self.TEST_DISCOVERY_RESPONSE = { self.TEST_DISCOVERY_RESPONSE = {
'versions': {'values': [fixture.V3Discovery(self.TEST_URL)]}} 'versions': {'values': [fixture.V3Discovery(self.TEST_URL)]}}
nextyear = 1 + time.gmtime().tm_year
self.TEST_RESPONSE_DICT = { self.TEST_RESPONSE_DICT = {
"token": { "token": {
"methods": [ "methods": [
@ -142,7 +144,7 @@ class V3IdentityPlugin(utils.TestCase):
"password" "password"
], ],
"expires_at": "2020-01-01T00:00:10.000123Z", "expires_at": "%i-02-01T00:00:10.000123Z" % nextyear,
"project": { "project": {
"domain": { "domain": {
"id": self.TEST_DOMAIN_ID, "id": self.TEST_DOMAIN_ID,
@ -195,7 +197,7 @@ class V3IdentityPlugin(utils.TestCase):
"application_credential" "application_credential"
], ],
"expires_at": "2020-01-01T00:00:10.000123Z", "expires_at": "%i-02-01T00:00:10.000123Z" % nextyear,
"project": { "project": {
"domain": { "domain": {
"id": self.TEST_DOMAIN_ID, "id": self.TEST_DOMAIN_ID,