Changeset 8aa20c7 in flexoentity for tests/test_id_lifecycle.py
- Timestamp:
- 11/01/25 15:51:10 (2 months ago)
- Branches:
- master
- Children:
- 5c72356
- Parents:
- ca39274
- File:
-
- 1 edited
-
tests/test_id_lifecycle.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/test_id_lifecycle.py
rca39274 r8aa20c7 1 1 import pytest 2 from flexoentity import FlexOID, FlexoEntity, Entity Type, EntityState2 from flexoentity import FlexOID, FlexoEntity, EntityState 3 3 4 4 5 5 # ────────────────────────────────────────────────────────────────────────────── 6 # Tests adapted to use real RadioQuestion fixture instead of DummyEntity6 # Tests adapted to use real SingleChoiceQuestion fixture instead of DummyEntity 7 7 # ────────────────────────────────────────────────────────────────────────────── 8 8 9 def test_initial_state( radio_question):10 q = radio_question9 def test_initial_state(sample_question): 10 q = sample_question 11 11 assert q.state == EntityState.DRAFT 12 12 assert q.flexo_id.version == 1 … … 14 14 15 15 16 def test_approval_ bumps_version(radio_question):17 q = radio_question16 def test_approval_does_not_bump_version(sample_question): 17 q = sample_question 18 18 q.approve() 19 19 assert q.state == EntityState.APPROVED 20 assert q.flexo_id.version == 220 assert q.flexo_id.version == 1 21 21 22 22 23 def test_signing_bumps_version( radio_question):24 q = radio_question23 def test_signing_bumps_version(sample_question): 24 q = sample_question 25 25 q.approve() 26 26 v_before = str(q.flexo_id) … … 30 30 31 31 32 def test_publish_bumps_version( radio_question):33 q = radio_question32 def test_publish_bumps_version(sample_question): 33 q = sample_question 34 34 q.approve() 35 35 q.sign() … … 40 40 41 41 42 def test_modify_content_changes_fingerprint( radio_question):43 q = radio_question44 q.text = "Rephrased content" # simulate text change42 def test_modify_content_changes_fingerprint(sample_question): 43 q = sample_question 44 q.text += "Rephrased content" # simulate text change 45 45 changed = q._update_fingerprint() 46 46 assert changed 47 47 48 48 49 def test_no_version_bump_on_draft_edits( radio_question):50 q = radio_question49 def test_no_version_bump_on_draft_edits(sample_question): 50 q = sample_question 51 51 q.text = "Minor draft edit" 52 52 q._update_fingerprint() … … 54 54 55 55 56 def test_version_bump_after_edit_and_sign( radio_question):57 q = radio_question56 def test_version_bump_after_edit_and_sign(sample_question): 57 q = sample_question 58 58 q.approve() 59 59 v1 = str(q.flexo_id) … … 63 63 64 64 65 def test_integrity_check_passes_and_fails( radio_question):66 q = radio_question65 def test_integrity_check_passes_and_fails(sample_question): 66 q = sample_question 67 67 q.approve() 68 68 assert FlexoEntity.verify_integrity(q) … … 73 73 74 74 75 def test_obsolete_state( radio_question):76 q = radio_question75 def test_obsolete_state(sample_question): 76 q = sample_question 77 77 q.approve() 78 78 q.sign() … … 82 82 83 83 84 def test_clone_new_base_resets_lineage( radio_question):85 q = radio_question84 def test_clone_new_base_resets_lineage(sample_question): 85 q = sample_question 86 86 q.approve() 87 87 q.sign() … … 94 94 assert q.flexo_id.version == 1 95 95 96 def test_clone_new_base_sets_origin( radio_question):97 q = radio_question96 def test_clone_new_base_sets_origin(sample_question): 97 q = sample_question 98 98 q.approve() 99 99 q.sign() … … 107 107 assert q.flexo_id != old_id 108 108 109 def test_mass_version_increments_until_obsolete( radio_question):110 q = radio_question109 def test_mass_version_increments_until_obsolete(sample_question): 110 q = sample_question 111 111 q.approve() 112 for _ in range(FlexOID.MAX_VERSION - 2):112 for _ in range(FlexOID.MAX_VERSION - 1): 113 113 q.bump_version() 114 114 with pytest.raises(RuntimeError, match="mark obsolete"):
Note:
See TracChangeset
for help on using the changeset viewer.
