feat(survey): add IETF landscape survey (kappa, phase0, rerate), gaps update; bump wimse-ect; gitignore run logs
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
"""Tests for act.vectors module — Appendix B test vectors."""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from act.token import decode_jws
|
||||
from act.vectors import generate_vectors, validate_vectors
|
||||
|
||||
SCHEMA_PATH = Path(__file__).resolve().parent.parent / "act" / "schema.json"
|
||||
|
||||
|
||||
class TestVectorGeneration:
|
||||
def test_generates_15_vectors(self):
|
||||
@@ -33,3 +39,32 @@ class TestVectorGeneration:
|
||||
class TestVectorValidation:
|
||||
def test_all_vectors_pass(self):
|
||||
assert validate_vectors() is True
|
||||
|
||||
|
||||
class TestVectorReproducibility:
|
||||
def test_compacts_are_deterministic(self):
|
||||
# Published Appendix B vectors must be byte-for-byte stable.
|
||||
v1, _ = generate_vectors()
|
||||
v2, _ = generate_vectors()
|
||||
a = {v.id: v.compact for v in v1}
|
||||
b = {v.id: v.compact for v in v2}
|
||||
assert a == b
|
||||
|
||||
|
||||
class TestSchemaConformance:
|
||||
def test_schema_is_well_formed(self):
|
||||
jsonschema = pytest.importorskip("jsonschema")
|
||||
schema = json.loads(SCHEMA_PATH.read_text())
|
||||
jsonschema.Draft202012Validator.check_schema(schema)
|
||||
|
||||
def test_valid_vectors_conform_to_schema(self):
|
||||
jsonschema = pytest.importorskip("jsonschema")
|
||||
schema = json.loads(SCHEMA_PATH.read_text())
|
||||
validator = jsonschema.Draft202012Validator(schema)
|
||||
vectors, _ = generate_vectors()
|
||||
valid_with_token = {"B.1", "B.2", "B.3", "B.4", "B.5"}
|
||||
for v in vectors:
|
||||
if v.id in valid_with_token:
|
||||
_h, claims, _s, _si = decode_jws(v.compact)
|
||||
errors = list(validator.iter_errors(claims))
|
||||
assert not errors, f"{v.id}: {errors}"
|
||||
|
||||
Reference in New Issue
Block a user