'Test the structure and content of feeds generated by Atom1Feed.'

def test_atom_feed(self):

    response = self.client.get('/syndication/atom/')
    feed = minidom.parseString(response.content).firstChild
    self.assertEqual(feed.nodeName, 'feed')
    self.assertEqual(feed.getAttribute('xmlns'), 'http://www.w3.org/2005/Atom')
    self.assertChildNodes(feed, ['title', 'subtitle', 'link', 'id', 'updated', 'entry', 'rights', 'category', 'author'])
    for link in feed.getElementsByTagName('link'):
        if (link.getAttribute('rel') == 'self'):
            self.assertEqual(link.getAttribute('href'), 'http://example.com/syndication/atom/')
    entries = feed.getElementsByTagName('entry')
    self.assertEqual(len(entries), Entry.objects.count())
    for entry in entries:
        self.assertChildNodes(entry, ['title', 'link', 'id', 'summary', 'category', 'updated', 'rights', 'author'])
        summary = entry.getElementsByTagName('summary')[0]
        self.assertEqual(summary.getAttribute('type'), 'html')
