Révision 5c367ca4
Ajouté par Serghei Mihai (congés, retour 15/05) il y a plus de 7 ans
tests/test_announces.py | ||
---|---|---|
6 | 6 |
from django.core.files.storage import DefaultStorage |
7 | 7 |
from django.utils import timezone |
8 | 8 |
from django.core.urlresolvers import reverse |
9 |
from django.conf import settings |
|
9 | 10 |
|
10 | 11 |
from corbo.models import Category, Announce |
11 | 12 |
|
... | ... | |
85 | 86 |
a.save() |
86 | 87 |
feed_content = feedparser.parse(app.get(reverse('atom')).text) |
87 | 88 |
assert len(feed_content['entries']) == 0 |
89 |
|
|
90 |
def test_rss_feed_items(app): |
|
91 |
c = Category.objects.create(name='Test announces') |
|
92 |
for i in xrange(10): |
|
93 |
a = Announce.objects.create(category=c, title='Test %s' % i, |
|
94 |
publication_time=timezone.now(), |
|
95 |
text='text of announce %s' % i) |
|
96 |
feed_content = feedparser.parse(app.get(reverse('atom')).text) |
|
97 |
assert len(feed_content['entries']) <= settings.RSS_ITEMS_LIMIT |
|
98 |
for i in xrange(i, 10): |
|
99 |
a = Announce.objects.create(category=c, title='Test %s' % i, |
|
100 |
publication_time=timezone.now(), |
|
101 |
text='text of announce %s' % i) |
|
102 |
assert len(feed_content['entries']) <= settings.RSS_ITEMS_LIMIT |
Formats disponibles : Unified diff
limit items in rss feed (#14798)