-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Locking an unlocked EncEntry did not update locked status
- Loading branch information
Showing
3 changed files
with
45 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from encyclopaedia import EncEntry, Encyclopaedia | ||
|
||
|
||
def test_encentry_lock(): | ||
""" | ||
When an EncEntry is unlocked | ||
And it's locked | ||
Then the locked status should update | ||
""" | ||
enc = Encyclopaedia() | ||
|
||
e = EncEntry( | ||
parent=enc, | ||
name="Test Name", | ||
text=["Test Text"], | ||
locked=False, | ||
) | ||
|
||
e.locked = True | ||
|
||
assert e.locked is True | ||
|
||
|
||
def test_encentry_unlock(): | ||
enc = Encyclopaedia() | ||
|
||
e = EncEntry( | ||
parent=enc, | ||
name="Test Name", | ||
text=["Test Text"], | ||
locked=True, | ||
|
||
) | ||
|
||
assert e in enc.all_entries | ||
assert e not in enc.unlocked_entries | ||
|
||
# Unlock the first entry | ||
e.locked = False | ||
assert e.locked is False | ||
|
||
assert e in enc.all_entries | ||
assert e in enc.unlocked_entries |