Changeset ca39274 in flexoentity for tests


Ignore:
Timestamp:
10/28/25 12:16:31 (3 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
master
Children:
8aa20c7
Parents:
52ccac6
Message:

minor cleanups

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/test_id_lifecycle.py

    r52ccac6 rca39274  
    9999    q.sign()
    100100    q.publish()
     101    q.obsolete()
    101102    old_id = str(q.flexo_id)
    102     q.obsolete()
    103103    q.clone_new_base()
    104104    assert q.origin == old_id
  • tests/test_persistance_integrity.py

    r52ccac6 rca39274  
    66import pytest
    77
    8 from flexoentity import EntityState
    98from builder.questions import RadioQuestion, AnswerOption
     9from flexoentity import EntityState, EntityType, Domain
    1010
    11 
    12 # ──────────────────────────────────────────────────────────────────────────────
    1311@pytest.fixture
    14 def approved_question(domain):
     12def approved_question():
    1513    """Provide a fully approved and published RadioQuestion for persistence tests."""
    1614    q = RadioQuestion(
    17         domain=domain,
     15        domain=Domain(domain="GEN", etype=EntityType.DOMAIN, state=EntityState.DRAFT),
    1816        etype=None,  # RadioQuestion sets this internally to EntityType.QUESTION
    1917        state=EntityState.DRAFT,
    2018        text="What is Ohm’s law?",
    2119        options=[
    22             AnswerOption(text="U = R × I", points=1),
    23             AnswerOption(text="U = I / R", points=0),
    24             AnswerOption(text="R = U × I", points=0),
     20            AnswerOption(id="OP1", text="U = R × I", points=1),
     21            AnswerOption(id="OP2", text="U = I / R", points=0),
     22            AnswerOption(id="OP3", text="R = U × I", points=0),
    2523        ],
    2624    )
     
    3735    """
    3836    json_str = approved_question.to_json()
     37    print("JSON", json_str)
    3938    loaded = RadioQuestion.from_json(json_str)
    4039
     40    print("Approved", approved_question.text_seed)
     41    print("Loaded", loaded.text_seed)
    4142    # Fingerprint and state should match — integrity must pass
    4243    assert RadioQuestion.verify_integrity(loaded)
     
    4647    assert approved_question.flexo_id == loaded.flexo_id
    4748    assert loaded.state == approved_question.state
    48 
    49 
    50 # ──────────────────────────────────────────────────────────────────────────────
    5149
    5250@pytest.mark.skip(reason="FlexOIDs regenerated on import; tampering detection not yet implemented")
     
    6058    loaded = RadioQuestion.from_json(tampered_json)
    6159    assert not RadioQuestion.verify_integrity(loaded)
    62 
    63 
    64 # ──────────────────────────────────────────────────────────────────────────────
    6560
    6661@pytest.mark.skip(reason="FlexOIDs regenerated on import; corruption detection not yet applicable")
Note: See TracChangeset for help on using the changeset viewer.