fix: undefined variable

Closes #10
This commit is contained in:
Dmitriy Pleshevskiy 2020-11-08 04:43:19 +03:00
parent be86824ab0
commit a1be542f41
3 changed files with 10 additions and 4 deletions

3
.gitignore vendored
View file

@ -152,4 +152,5 @@ tags
# IDE
.idea/
.c9/
.c9/
.vscode/

View file

@ -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:

View file

@ -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>{image_url}</url>'
assert (
'<image>'
f'<url>{image_url}</url>'
'<link>https://smartfridge.me/</link>'
'<title><![CDATA[SmartFridge]]></title>'
'<link>https://smartfridge.me/</link></image>') in xml
'</image>'
) in xml
def test_feed_webmaster():