diff --git a/tests/suites/1_stateful/09_http_handler/09_0007_token.py b/tests/suites/1_stateful/09_http_handler/09_0007_token.py index 9f5b302381f8..2ec350a1918d 100755 --- a/tests/suites/1_stateful/09_http_handler/09_0007_token.py +++ b/tests/suites/1_stateful/09_http_handler/09_0007_token.py @@ -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") ) @@ -191,6 +191,7 @@ def main(): if __name__ == "__main__": import logging + try: main() except Exception as e: diff --git a/tests/suites/1_stateful/09_http_handler/09_0009_cookie.py b/tests/suites/1_stateful/09_http_handler/09_0009_cookie.py index 1a424f450e0a..910f0c1cbe2b 100755 --- a/tests/suites/1_stateful/09_http_handler/09_0009_cookie.py +++ b/tests/suites/1_stateful/09_http_handler/09_0009_cookie.py @@ -8,13 +8,14 @@ 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): @@ -22,11 +23,11 @@ def get_dict(self, domain=None, path=None): 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 @@ -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) @@ -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"] @@ -99,6 +100,7 @@ def main(): test_simple() test_temp_table() + if __name__ == "__main__": try: main()