@@ 140-152 (lines=13) @@ | ||
137 | self.request.route_url.assert_has_calls([call('test', id=new_current_id)]) |
|
138 | self.assertEqual(2, len(self.atom_feed_manager.current_feed.entries)) |
|
139 | ||
140 | def test_archive_current_feed(self): |
|
141 | self.request.registry.settings['feed.archive.split'] = None |
|
142 | old_current_id = self.atom_feed_manager.current_feed.id |
|
143 | feed_archive_path = fixture_directory + '/' + str(old_current_id) + '.xml' |
|
144 | m = mock_open() |
|
145 | with patch.object(builtins, 'open', m): |
|
146 | self.rest_views.archive_current_feed() |
|
147 | m.assert_called_once_with(feed_archive_path, 'w') |
|
148 | handle = m() |
|
149 | self.assertTrue(handle.write.called) |
|
150 | new_current_id = self.atom_feed_manager.current_feed.id |
|
151 | self.assertNotEqual(new_current_id, old_current_id) |
|
152 | self.request.route_url.assert_has_calls([call('test', id=new_current_id)]) |
|
153 | ||
154 | def validate_atom_feed(self, feed, atom_feed, siblings={}): |
|
155 | self.assertEqual(atom_feed.id(), 'test__id_' + str(feed.id)) |
|
@@ 126-138 (lines=13) @@ | ||
123 | self.rest_views.get_atom_feed() |
|
124 | get_from_archive_mock.assert_called_once_with(1) |
|
125 | ||
126 | def test_archive_split_current_feed(self): |
|
127 | old_current_id = self.atom_feed_manager.current_feed.id |
|
128 | feed_archive_path = fixture_directory + '/' + str(old_current_id) + '.xml' |
|
129 | m = mock_open() |
|
130 | with patch.object(builtins, 'open', m): |
|
131 | self.rest_views.archive_current_feed() |
|
132 | m.assert_has_calls(call(feed_archive_path, 'w')) |
|
133 | handle = m() |
|
134 | self.assertTrue(handle.write.called) |
|
135 | new_current_id = self.atom_feed_manager.current_feed.id |
|
136 | self.assertNotEqual(new_current_id, old_current_id) |
|
137 | self.request.route_url.assert_has_calls([call('test', id=new_current_id)]) |
|
138 | self.assertEqual(2, len(self.atom_feed_manager.current_feed.entries)) |
|
139 | ||
140 | def test_archive_current_feed(self): |
|
141 | self.request.registry.settings['feed.archive.split'] = None |