mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 05:17:59 +01:00
Test selection for new password-protected stories
This commit is contained in:
parent
91eaea13b5
commit
b39586b143
1 changed files with 19 additions and 3 deletions
|
@ -249,22 +249,38 @@ class TestUpdateSelector:
|
|||
assert selected is old
|
||||
assert UpdateStatus.DELETED in old.flavors
|
||||
|
||||
def test_protected_selection(self, selector, story):
|
||||
def test_old_protected_selection(self, selector, story):
|
||||
"""
|
||||
Tests behavior for stories that have become password protected.
|
||||
Tests behavior for stories that have become password-protected.
|
||||
"""
|
||||
old = self.populate(story, 0)
|
||||
new = self.populate(story, 1)
|
||||
|
||||
fetcher = Mock(spec=Fetcher)
|
||||
fetcher.fetch_data.side_effect = InvalidStoryError
|
||||
new = story.merge(fetcher=fetcher, data=None)
|
||||
new = new.merge(fetcher=fetcher, data=None)
|
||||
|
||||
selected = selector(old, new)
|
||||
|
||||
fetcher.fetch_data.assert_called_once_with(new.key)
|
||||
assert selected is old
|
||||
assert UpdateStatus.DELETED in old.flavors
|
||||
|
||||
def test_new_protected_selection(self, selector, story):
|
||||
"""
|
||||
Tests behavior for new password-protected stories.
|
||||
"""
|
||||
new = self.populate(story, 1)
|
||||
|
||||
fetcher = Mock(spec=Fetcher)
|
||||
fetcher.fetch_data.side_effect = InvalidStoryError
|
||||
new = new.merge(fetcher=fetcher, data=None)
|
||||
|
||||
selected = selector(None, new)
|
||||
|
||||
fetcher.fetch_data.assert_called_once_with(new.key)
|
||||
assert selected is None
|
||||
|
||||
def test_invalid_selection(self, selector):
|
||||
"""
|
||||
Tests behavior for invalid stories.
|
||||
|
|
Loading…
Reference in a new issue