mirror of https://github.com/django/django.git
Refs #13110 -- Fixed mistakes in the new multiple enclosure feed tests
This commit is contained in:
parent
1a09b3c398
commit
a4b80e2421
|
@ -427,7 +427,7 @@ class Atom1Feed(SyndicationFeed):
|
||||||
handler.addQuickElement("summary", item['description'], {"type": "html"})
|
handler.addQuickElement("summary", item['description'], {"type": "html"})
|
||||||
|
|
||||||
# Enclosures.
|
# Enclosures.
|
||||||
for enclosure in item.get('enclosures') or []:
|
for enclosure in item['enclosures']:
|
||||||
handler.addQuickElement('link', '', {
|
handler.addQuickElement('link', '', {
|
||||||
'rel': 'enclosure',
|
'rel': 'enclosure',
|
||||||
'href': enclosure.url,
|
'href': enclosure.url,
|
||||||
|
|
|
@ -208,6 +208,6 @@ class TestMultipleEnclosureAtomFeed(TestAtomFeed):
|
||||||
"""
|
"""
|
||||||
def item_enclosures(self, item):
|
def item_enclosures(self, item):
|
||||||
return [
|
return [
|
||||||
feedgenerator.Enclosure('http://example.com/hello.png', 0, 'image/png'),
|
feedgenerator.Enclosure('http://example.com/hello.png', '0', 'image/png'),
|
||||||
feedgenerator.Enclosure('http://example.com/goodbye.png', 0, 'image/png'),
|
feedgenerator.Enclosure('http://example.com/goodbye.png', '0', 'image/png'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -300,7 +300,7 @@ class SyndicationFeedTest(FeedTestCase):
|
||||||
self.assertNotEqual(published, updated)
|
self.assertNotEqual(published, updated)
|
||||||
|
|
||||||
def test_atom_single_enclosure(self):
|
def test_atom_single_enclosure(self):
|
||||||
response = self.client.get('/syndication/rss2/single-enclosure/')
|
response = self.client.get('/syndication/atom/single-enclosure/')
|
||||||
feed = minidom.parseString(response.content).firstChild
|
feed = minidom.parseString(response.content).firstChild
|
||||||
items = feed.getElementsByTagName('entry')
|
items = feed.getElementsByTagName('entry')
|
||||||
for item in items:
|
for item in items:
|
||||||
|
@ -309,7 +309,7 @@ class SyndicationFeedTest(FeedTestCase):
|
||||||
self.assertEqual(len(links), 1)
|
self.assertEqual(len(links), 1)
|
||||||
|
|
||||||
def test_atom_multiple_enclosures(self):
|
def test_atom_multiple_enclosures(self):
|
||||||
response = self.client.get('/syndication/rss2/single-enclosure/')
|
response = self.client.get('/syndication/atom/multiple-enclosure/')
|
||||||
feed = minidom.parseString(response.content).firstChild
|
feed = minidom.parseString(response.content).firstChild
|
||||||
items = feed.getElementsByTagName('entry')
|
items = feed.getElementsByTagName('entry')
|
||||||
for item in items:
|
for item in items:
|
||||||
|
|
Loading…
Reference in New Issue