Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Oct 30, 2024
1 parent 3a91ff2 commit 7817b23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions tests/suites/1_stateful/09_http_handler/09_0007_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def fake_expired_token(ty):
"sid": "",
}
return (
"bend-v1-"
+ ty
+ "-"
+ base64.b64encode(json.dumps(expired_claim).encode("utf-8")).decode("utf-8")
"bend-v1-"
+ ty
+ "-"
+ base64.b64encode(json.dumps(expired_claim).encode("utf-8")).decode("utf-8")
)


Expand All @@ -130,13 +130,12 @@ def main():
session_token = login_resp.get("session_token")
refresh_token = login_resp.get("refresh_token")
# print(session_token)
return

# ok
query_resp = do_query("select 1", session_token)
pprint(query_resp.get("data"))
pprint(query_resp.get("session").get("need_sticky"))
pprint(query_resp.get("session").get("need_refresh"))
pprint(query_resp.get("session").get("need_keep_alive"))

# cluster
query_resp = do_query("select count(*) from system.clusters", session_token)
Expand All @@ -150,11 +149,11 @@ def main():
# temp table
query_resp = do_query("CREATE TEMP TABLE t(c1 int)", session_token)
pprint(query_resp.get("session").get("need_sticky"))
pprint(query_resp.get("session").get("need_refresh"))
pprint(query_resp.get("session").get("need_keep_alive"))

query_resp = do_query("drop TABLE t", session_token)
pprint(query_resp.get("session").get("need_sticky"))
pprint(query_resp.get("session").get("need_refresh"))
pprint(query_resp.get("session").get("need_keep_alive"))

# errors
do_query("select 2", "xxx")
Expand Down Expand Up @@ -191,7 +190,8 @@ def main():


if __name__ == "__main__":
import logging
try:
main()
except Exception as e:
print(f"An error occurred: {e}")
logging.exception(f"An error occurred: {e}")
10 changes: 5 additions & 5 deletions tests/suites/1_stateful/09_http_handler/09_0007_token.result
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---- do_login()
200
['session_token_ttl_in_secs',
'refresh_token',
['refresh_token',
'session_id',
'session_token',
'session_token_ttl_in_secs',
'version']
---- do_query('select 1',)
200
[['1']]
False
True
False
---- do_query('select count(*) from system.clusters',)
200
---- do_query("select 'cluster'",)
Expand All @@ -22,7 +22,7 @@ True
---- do_query('drop TABLE t',)
200
False
True
False
---- do_query('select 2',)
401
{'code': 5100, 'message': 'jwt auth not configured.'}
Expand All @@ -39,7 +39,7 @@ True
{'code': 5100, 'message': 'wrong data token type'}
---- do_refresh(1,)
200
['session_token_ttl_in_secs', 'refresh_token', 'session_token']
['refresh_token', 'session_token', 'session_token_ttl_in_secs']
---- do_query('select 6',)
200
[['6']]
Expand Down

0 comments on commit 7817b23

Please sign in to comment.