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

def test_atom_feed(self):

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