Skip to content

Commit

Permalink
make lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyass committed Nov 7, 2024
1 parent f01a91e commit b948224
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
9 changes: 5 additions & 4 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 Down Expand Up @@ -191,6 +191,7 @@ def main():

if __name__ == "__main__":
import logging

try:
main()
except Exception as e:
Expand Down
16 changes: 9 additions & 7 deletions tests/suites/1_stateful/09_http_handler/09_0009_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@
auth = ("root", "")
logging.basicConfig(level=logging.ERROR, format="%(asctime)s %(levelname)s %(message)s")


class GlobalCookieJar(RequestsCookieJar):
def __init__(self):
super().__init__()

def set_cookie(self, cookie: Cookie, *args, **kwargs):
cookie.domain = ''
cookie.path = '/'
cookie.domain = ""
cookie.path = "/"
super().set_cookie(cookie, *args, **kwargs)

def get_dict(self, domain=None, path=None):
# 忽略 domain 和 path 参数,返回所有 Cookie
return {cookie.name: cookie.value for cookie in self}


def do_query(session_client, query, session_state=None ):
def do_query(session_client, query, session_state=None):
url = f"http://localhost:8000/v1/query"
query_payload = {
"sql": query,
"pagination": {"wait_time_secs": 100, 'max_rows_per_page': 2},
"pagination": {"wait_time_secs": 100, "max_rows_per_page": 2},
}
if session_state:
query_payload["session"] = session_state
Expand All @@ -47,10 +48,10 @@ def test_simple():
assert resp.status_code == 200, resp.text
assert resp.json()["data"] == [["1"]], resp.text
sid = client.cookies.get("session_id")
#print(sid)
# print(sid)

last_access_time1 = int(client.cookies.get("last_access_time"))
#print(last_access_time1)
# print(last_access_time1)
assert time.time() - 10 < last_access_time1 < time.time()

time.sleep(1.5)
Expand Down Expand Up @@ -83,7 +84,7 @@ def test_temp_table():

resp = do_query(client, "select * from t1", session_state)
assert resp.status_code == 200, resp.text
assert resp.json()['data'] == [["3"], ["4"]]
assert resp.json()["data"] == [["3"], ["4"]]
session_state = resp.json()["session"]
assert session_state["need_sticky"], resp.text
assert session_state["need_keep_alive"]
Expand All @@ -99,6 +100,7 @@ def main():
test_simple()
test_temp_table()


if __name__ == "__main__":
try:
main()
Expand Down

0 comments on commit b948224

Please sign in to comment.