UPDATE
This commit is contained in:
@@ -9,7 +9,7 @@ from utils.template import render
|
||||
config = load_config()
|
||||
|
||||
BASE_URL = config["base_url"]
|
||||
flow = config["flows"]["register_login"]
|
||||
flow = config["flows"]["auth"]
|
||||
|
||||
redis_client = redis.Redis(
|
||||
host="redis",
|
||||
@@ -22,26 +22,9 @@ def test_auth_flow():
|
||||
|
||||
context = {}
|
||||
|
||||
context["random_username"] = f"user_{uuid.uuid4().hex[:6]}"
|
||||
|
||||
# -------- register --------
|
||||
|
||||
register = flow["register"]
|
||||
|
||||
body = render(register["body"], context)
|
||||
|
||||
res = http_request(
|
||||
register["method"],
|
||||
BASE_URL + register["path"],
|
||||
json=body
|
||||
)
|
||||
|
||||
assert res["status_code"] == register["expected_status"]
|
||||
|
||||
assert res["json"]["msg"] == register["expected_json"]["msg"]
|
||||
|
||||
# -------- login --------
|
||||
|
||||
login = flow["login"]
|
||||
|
||||
body = render(login["body"], context)
|
||||
@@ -49,14 +32,16 @@ def test_auth_flow():
|
||||
res = http_request(
|
||||
login["method"],
|
||||
BASE_URL + login["path"],
|
||||
authenticated=False,
|
||||
json=body
|
||||
)
|
||||
print(res)
|
||||
|
||||
assert res["status_code"] == login["expected_status"]
|
||||
assert res["status"] == login["expected_status"]
|
||||
|
||||
token_field = login["extract"]["token"]
|
||||
|
||||
token = res["json"][token_field]
|
||||
token = res["data"][token_field]
|
||||
|
||||
assert token is not None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user