mirror of
https://github.com/Hopiu/django.git
synced 2026-04-23 00:04:48 +00:00
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8310 bcc190cf-cafb-0310-a4f2-bffc1f526a37
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from xml.dom import minidom
|
|
from django.test import TestCase
|
|
from django.test.client import Client
|
|
from models import Entry
|
|
|
|
class SyndicationFeedTest(TestCase):
|
|
fixtures = ['feeddata.json']
|
|
|
|
def test_rss_feed(self):
|
|
response = self.client.get('/syndication/feeds/rss/')
|
|
doc = minidom.parseString(response.content)
|
|
self.assertEqual(len(doc.getElementsByTagName('channel')), 1)
|
|
self.assertEqual(len(doc.getElementsByTagName('item')), Entry.objects.count())
|
|
|
|
def test_atom_feed(self):
|
|
response = self.client.get('/syndication/feeds/atom/')
|
|
doc = minidom.parseString(response.content)
|
|
self.assertEqual(len(doc.getElementsByTagName('feed')), 1)
|
|
self.assertEqual(len(doc.getElementsByTagName('entry')), Entry.objects.count())
|
|
|
|
def test_complex_base_url(self):
|
|
"""
|
|
Tests that that the base url for a complex feed doesn't raise a 500
|
|
exception.
|
|
"""
|
|
response = self.client.get('/syndication/feeds/complex/')
|
|
self.assertEquals(response.status_code, 404)
|
|
|
|
|