summaryrefslogtreecommitdiffstats
path: root/tests/test_rss_feeds.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_rss_feeds.py')
-rw-r--r--tests/test_rss_feeds.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/test_rss_feeds.py b/tests/test_rss_feeds.py
index 3554a38..5eeb570 100644
--- a/tests/test_rss_feeds.py
+++ b/tests/test_rss_feeds.py
@@ -2,11 +2,8 @@
from __future__ import unicode_literals, absolute_import
-# This code is so you can run the samples without installing the package,
-# and should be before any import touching nikola, in any file under tests/
import os
import sys
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from collections import defaultdict
@@ -35,22 +32,25 @@ fake_conf['TRANSLATIONS_PATTERN'] = '{path}.{lang}.{ext}'
class FakeCompiler(object):
demote_headers = False
compile_html = None
+ extension = lambda self: '.html'
class RSSFeedTest(unittest.TestCase):
def setUp(self):
LocaleSupportInTesting.initialize_locales_for_testing('unilingual')
-
self.blog_url = "http://some.blog"
with mock.patch('nikola.post.get_meta',
- mock.Mock(return_value=({'title': 'post title',
- 'slug': 'awesome_article',
- 'date': '2012-10-01 22:41',
- 'author': None,
- 'tags': 'tags', 'link':
- 'link', 'description':
- 'description'}))):
+ mock.Mock(return_value=(
+ {'title': 'post title',
+ 'slug': 'awesome_article',
+ 'date': '2012-10-01 22:41',
+ 'author': None,
+ 'tags': 'tags',
+ 'link': 'link',
+ 'description': 'description',
+ 'enclosure': 'http://www.example.org/foo.mp3'}
+ ))):
with mock.patch('nikola.nikola.utils.os.path.isdir',
mock.Mock(return_value=True)):
with mock.patch('nikola.nikola.Post.text',
@@ -66,19 +66,19 @@ class RSSFeedTest(unittest.TestCase):
opener_mock = mock.mock_open()
- with mock.patch('nikola.nikola.codecs.open', opener_mock, create=True):
- nikola.nikola.utils.generic_rss_renderer('en',
- "blog_title",
- self.blog_url,
- "blog_description",
- [example_post,
- ],
- 'testfeed.rss',
- True,
- False)
+ with mock.patch('nikola.nikola.io.open', opener_mock, create=True):
+ nikola.nikola.Nikola().generic_rss_renderer('en',
+ "blog_title",
+ self.blog_url,
+ "blog_description",
+ [example_post,
+ ],
+ 'testfeed.rss',
+ True,
+ False)
opener_mock.assert_called_once_with(
- 'testfeed.rss', 'wb+', 'utf-8')
+ 'testfeed.rss', 'w+', encoding='utf-8')
# Python 3 / unicode strings workaround
# lxml will complain if the encoding is specified in the