Skip to content

Commit

Permalink
Merge pull request #2532 from amazeeio/testing/token_refresh
Browse files Browse the repository at this point in the history
Unconditionally refresh api token in test suite
  • Loading branch information
Toby Bellwood authored Feb 23, 2021
2 parents a69ed2a + fe286f3 commit 35140c2
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tests/tasks/api/refresh_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@

access_token = jwt.decode(grant['access_token'], verify=False)

current_time = int(time.time())

if current_time < access_token['exp']:
print grant_raw
else:
data = {'client_id': 'auth-server',
'client_secret': auth_server_client_secret,
'grant_type': 'refresh_token',
'refresh_token': grant['refresh_token']}

r = requests.post(url = "http://keycloak:8080/auth/realms/lagoon/protocol/openid-connect/token", data = data)
print r.text
data = {'client_id': 'auth-server',
'client_secret': auth_server_client_secret,
'grant_type': 'refresh_token',
'refresh_token': grant['refresh_token']}

r = requests.post(url = "http://keycloak:8080/auth/realms/lagoon/protocol/openid-connect/token", data = data)
print r.text

0 comments on commit 35140c2

Please sign in to comment.