Merge pull request #11 from icetemple/bug-10

fix: undefined variable
This commit is contained in:
Dmitriy Pleshevskiy 2020-11-08 03:45:39 +02:00 committed by GitHub
commit b4c815b801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

1
.gitignore vendored
View file

@ -153,3 +153,4 @@ tags
# IDE # IDE
.idea/ .idea/
.c9/ .c9/
.vscode/

View file

@ -100,7 +100,7 @@ class GenRSS:
channel_image = self.image channel_image = self.image
if not channel_image and self.image_url: if not channel_image and self.image_url:
channel_image = Image(self.image_url, self.site_url, self.title) 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()) channel.append(channel_image.to_element())
for category in self.categories: for category in self.categories:

View file

@ -80,10 +80,15 @@ def test_feed_image_url():
image_url = 'https://s3.smartfridge.me/image.jpg' image_url = 'https://s3.smartfridge.me/image.jpg'
feed = create_rss(image_url=image_url) feed = create_rss(image_url=image_url)
xml = feed.xml() xml = feed.xml()
assert 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>' '<title><![CDATA[SmartFridge]]></title>'
'<link>https://smartfridge.me/</link></image>') in xml '</image>'
) in xml
def test_feed_webmaster(): def test_feed_webmaster():