Skip to content

Commit

Permalink
tests: Add missing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Oct 21, 2024
1 parent 209a61f commit db35480
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/actions/test_next_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ def test_next_entry_get_sensitive_no_active():
text=["Test Text"],
)

EncEntry(
parent=enc,
name="Entry 2",
text=["Test Text"],
)
assert enc.active is None

enc.NextEntry()()
result = enc.NextEntry().get_sensitive()
assert not result
assert result is False
51 changes: 51 additions & 0 deletions tests/actions/test_set_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,54 @@ def test_set_entry_book_viewed():

assert book.viewed is False
assert book.active.viewed is True


def test_set_entry_get_sensitive_entry_unlocked():
enc = Encyclopaedia()

e = EncEntry(
parent=enc,
name="Entry 1",
text=["Test Text"],
)

action = enc.SetEntry(e)

result = action.get_sensitive()

assert result is True


def test_set_entry_get_sensitive_entry_locked():
enc = Encyclopaedia()

e = EncEntry(
parent=enc,
name="Entry 1",
text=["Test Text"],
locked=True,
)

action = enc.SetEntry(e)

result = action.get_sensitive()

assert result is False


def test_set_entry_get_selected():
enc = Encyclopaedia()

e = EncEntry(
parent=enc,
name="Entry 1",
text=["Test Text"],
)

action = enc.SetEntry(e)

action()

result = action.get_selected()

assert result is True

0 comments on commit db35480

Please sign in to comment.