From a1be542f41530334c6665ad48ddd432b96ab59ca Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 8 Nov 2020 04:43:19 +0300 Subject: [PATCH] fix: undefined variable Closes #10 --- .gitignore | 3 ++- genrss/__init__.py | 2 +- tests/test_rss.py | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d9ecf51..361de9e 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,5 @@ tags # IDE .idea/ -.c9/ \ No newline at end of file +.c9/ +.vscode/ \ No newline at end of file diff --git a/genrss/__init__.py b/genrss/__init__.py index 5dd3096..725cba3 100644 --- a/genrss/__init__.py +++ b/genrss/__init__.py @@ -100,7 +100,7 @@ class GenRSS: channel_image = self.image if not channel_image and self.image_url: channel_image = Image(self.image_url, self.site_url, self.title) - if isinstance(image, Image): + if isinstance(channel_image, Image): channel.append(channel_image.to_element()) for category in self.categories: diff --git a/tests/test_rss.py b/tests/test_rss.py index d9c0eff..cbae47f 100644 --- a/tests/test_rss.py +++ b/tests/test_rss.py @@ -80,10 +80,15 @@ def test_feed_image_url(): image_url = 'https://s3.smartfridge.me/image.jpg' feed = create_rss(image_url=image_url) xml = feed.xml() + assert xml - assert (f'{image_url}' + assert ( + '' + f'{image_url}' + 'https://smartfridge.me/' '<![CDATA[SmartFridge]]>' - 'https://smartfridge.me/') in xml + '' + ) in xml def test_feed_webmaster():