From b39586b143aca31a9a708ff9fbc390078e25687b Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Fri, 17 Feb 2017 23:48:39 +0100 Subject: [PATCH] Test selection for new password-protected stories --- tests/test_selectors.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/test_selectors.py b/tests/test_selectors.py index 26b926d..28d49ff 100644 --- a/tests/test_selectors.py +++ b/tests/test_selectors.py @@ -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.