Changeset 8aa20c7 in flexoentity for tests/test_id_lifecycle.py


Ignore:
Timestamp:
11/01/25 15:51:10 (2 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
master
Children:
5c72356
Parents:
ca39274
Message:

full refactoring of FlexOID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_id_lifecycle.py

    rca39274 r8aa20c7  
    11import pytest
    2 from flexoentity import FlexOID, FlexoEntity, EntityType, EntityState
     2from flexoentity import FlexOID, FlexoEntity, EntityState
    33
    44
    55# ──────────────────────────────────────────────────────────────────────────────
    6 # Tests adapted to use real RadioQuestion fixture instead of DummyEntity
     6# Tests adapted to use real SingleChoiceQuestion fixture instead of DummyEntity
    77# ──────────────────────────────────────────────────────────────────────────────
    88
    9 def test_initial_state(radio_question):
    10     q = radio_question
     9def test_initial_state(sample_question):
     10    q = sample_question
    1111    assert q.state == EntityState.DRAFT
    1212    assert q.flexo_id.version == 1
     
    1414
    1515
    16 def test_approval_bumps_version(radio_question):
    17     q = radio_question
     16def test_approval_does_not_bump_version(sample_question):
     17    q = sample_question
    1818    q.approve()
    1919    assert q.state == EntityState.APPROVED
    20     assert q.flexo_id.version == 2
     20    assert q.flexo_id.version == 1
    2121
    2222
    23 def test_signing_bumps_version(radio_question):
    24     q = radio_question
     23def test_signing_bumps_version(sample_question):
     24    q = sample_question
    2525    q.approve()
    2626    v_before = str(q.flexo_id)
     
    3030
    3131
    32 def test_publish_bumps_version(radio_question):
    33     q = radio_question
     32def test_publish_bumps_version(sample_question):
     33    q = sample_question
    3434    q.approve()
    3535    q.sign()
     
    4040
    4141
    42 def test_modify_content_changes_fingerprint(radio_question):
    43     q = radio_question
    44     q.text = "Rephrased content"  # simulate text change
     42def test_modify_content_changes_fingerprint(sample_question):
     43    q = sample_question
     44    q.text += "Rephrased content"  # simulate text change
    4545    changed = q._update_fingerprint()
    4646    assert changed
    4747
    4848
    49 def test_no_version_bump_on_draft_edits(radio_question):
    50     q = radio_question
     49def test_no_version_bump_on_draft_edits(sample_question):
     50    q = sample_question
    5151    q.text = "Minor draft edit"
    5252    q._update_fingerprint()
     
    5454
    5555
    56 def test_version_bump_after_edit_and_sign(radio_question):
    57     q = radio_question
     56def test_version_bump_after_edit_and_sign(sample_question):
     57    q = sample_question
    5858    q.approve()
    5959    v1 = str(q.flexo_id)
     
    6363
    6464
    65 def test_integrity_check_passes_and_fails(radio_question):
    66     q = radio_question
     65def test_integrity_check_passes_and_fails(sample_question):
     66    q = sample_question
    6767    q.approve()
    6868    assert FlexoEntity.verify_integrity(q)
     
    7373
    7474
    75 def test_obsolete_state(radio_question):
    76     q = radio_question
     75def test_obsolete_state(sample_question):
     76    q = sample_question
    7777    q.approve()
    7878    q.sign()
     
    8282
    8383
    84 def test_clone_new_base_resets_lineage(radio_question):
    85     q = radio_question
     84def test_clone_new_base_resets_lineage(sample_question):
     85    q = sample_question
    8686    q.approve()
    8787    q.sign()
     
    9494    assert q.flexo_id.version == 1
    9595
    96 def test_clone_new_base_sets_origin(radio_question):
    97     q = radio_question
     96def test_clone_new_base_sets_origin(sample_question):
     97    q = sample_question
    9898    q.approve()
    9999    q.sign()
     
    107107    assert q.flexo_id != old_id
    108108
    109 def test_mass_version_increments_until_obsolete(radio_question):
    110     q = radio_question
     109def test_mass_version_increments_until_obsolete(sample_question):
     110    q = sample_question
    111111    q.approve()
    112     for _ in range(FlexOID.MAX_VERSION - 2):
     112    for _ in range(FlexOID.MAX_VERSION - 1):
    113113        q.bump_version()
    114114    with pytest.raises(RuntimeError, match="mark obsolete"):
Note: See TracChangeset for help on using the changeset viewer.