TEST: Use auth type-specific digest length

parent c98fbbe7
from certapi.validators import validate_digest, validate_sid from certapi.validators import validate_digest, validate_sid, DIGEST_LEN
def good_req_sid_useless_cert_broken(client, good_data, redis_mock, bad_cert): def good_req_sid_useless_cert_broken(client, good_data, redis_mock, bad_cert):
...@@ -12,7 +12,7 @@ def good_req_sid_useless_cert_broken(client, good_data, redis_mock, bad_cert): ...@@ -12,7 +12,7 @@ def good_req_sid_useless_cert_broken(client, good_data, redis_mock, bad_cert):
assert rv.status_code == 200 assert rv.status_code == 200
resp_data = rv.get_json() resp_data = rv.get_json()
assert resp_data["status"] == "authenticate" assert resp_data["status"] == "authenticate"
validate_digest(resp_data["nonce"]) validate_digest(resp_data["nonce"], DIGEST_LEN[good_data[0]["auth_type"]])
validate_sid(resp_data["sid"]) validate_sid(resp_data["sid"])
......
from certapi.validators import validate_digest, validate_sid from certapi.validators import validate_digest, validate_sid, DIGEST_LEN
def test_good_renew(client, good_req_get_cert_renew, redis_mock): def test_good_renew(client, good_req_get_cert_renew, redis_mock):
...@@ -10,7 +10,7 @@ def test_good_renew(client, good_req_get_cert_renew, redis_mock): ...@@ -10,7 +10,7 @@ def test_good_renew(client, good_req_get_cert_renew, redis_mock):
assert rv.status_code == 200 assert rv.status_code == 200
resp_data = rv.get_json() resp_data = rv.get_json()
assert resp_data["status"] == "authenticate" assert resp_data["status"] == "authenticate"
validate_digest(resp_data["nonce"]) validate_digest(resp_data["nonce"], DIGEST_LEN[good_req_get_cert_renew["auth_type"]])
validate_sid(resp_data["sid"]) validate_sid(resp_data["sid"])
...@@ -27,7 +27,7 @@ def good_sid_useless_cert_missing(client, good_data, redis_mock): ...@@ -27,7 +27,7 @@ def good_sid_useless_cert_missing(client, good_data, redis_mock):
assert rv.status_code == 200 assert rv.status_code == 200
resp_data = rv.get_json() resp_data = rv.get_json()
assert resp_data["status"] == "authenticate" assert resp_data["status"] == "authenticate"
validate_digest(resp_data["nonce"]) validate_digest(resp_data["nonce"], DIGEST_LEN[good_data[0]["auth_type"]])
validate_sid(resp_data["sid"]) validate_sid(resp_data["sid"])
...@@ -117,7 +117,7 @@ def test_good_sid_set_auth_ok_cert_missing(client, good_data, redis_mock): ...@@ -117,7 +117,7 @@ def test_good_sid_set_auth_ok_cert_missing(client, good_data, redis_mock):
assert rv.status_code == 200 assert rv.status_code == 200
resp_data = rv.get_json() resp_data = rv.get_json()
assert resp_data["status"] == "authenticate" assert resp_data["status"] == "authenticate"
validate_digest(resp_data["nonce"]) validate_digest(resp_data["nonce"], DIGEST_LEN[good_data[0]["auth_type"]])
validate_sid(resp_data["sid"]) validate_sid(resp_data["sid"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment