<s> from __future__ import unicode_literals <EOL> from datetime import timedelta <EOL> from django . core . urlresolvers import reverse <EOL> from django . test import TransactionTestCase <EOL> from django . utils . timezone import now <EOL> from django . utils . translation import override <EOL> from aldryn_newsblog . feeds import LatestArticlesFeed , TagFeed , CategoryFeed <EOL> from . import NewsBlogTestsMixin <EOL> class TestFeeds ( NewsBlogTestsMixin , TransactionTestCase ) : <EOL> def test_latest_feeds ( self ) : <EOL> article = self . create_article ( ) <EOL> future_article = self . create_article ( <EOL> publishing_date = now ( ) + timedelta ( days = <NUM_LIT:3> ) , <EOL> is_published = True , <EOL> ) <EOL> url = reverse ( <EOL> '<STR_LIT>' . format ( self . app_config . namespace ) <EOL> ) <EOL> self . request = self . get_request ( '<STR_LIT>' , url ) <EOL> self . request . current_page = self . page <EOL> feed = LatestArticlesFeed ( ) ( self . request ) <EOL> self . assertContains ( feed , article . title ) <EOL> self . assertNotContains ( feed , future_article . title ) <EOL> def test_tag_feed ( self ) : <EOL> articles = self . create_tagged_articles ( ) <EOL> url = reverse ( <EOL> '<STR_LIT>' . format ( self . app_config . namespace ) , <EOL> args = [ '<STR_LIT>' ] <EOL> ) <EOL> self . request = self . get_request ( '<STR_LIT>' , url ) <EOL> if getattr ( self . request , '<STR_LIT>' , None ) is None : <EOL> self . request . current_page = self . page <EOL> feed = TagFeed ( ) ( self . request , '<STR_LIT>' ) <EOL> for article in articles [ '<STR_LIT>' ] : <EOL> self . assertContains ( feed , article . title ) <EOL> for different_tag_article in articles [ '<STR_LIT>' ] : <EOL> self . assertNotContains ( feed , different_tag_article . title ) <EOL> def test_category_feed ( self ) : <EOL> lang = self . category1 . get_current_language ( ) <EOL> with override ( lang ) : <EOL> article = self . create_article ( ) <EOL> article . categories . add ( self . category1 ) <EOL> different_category_article = self . create_article ( ) <EOL> different_category_article . categories . add ( self . category2 ) <EOL> url = reverse ( <EOL> '<STR_LIT>' . format ( <EOL> self . app_config . namespace ) , <EOL> args = [ self . category1 . slug ] <EOL> ) <EOL> self . request = self . get_request ( lang , url ) <EOL> if getattr ( self . request , '<STR_LIT>' , None ) is None : <EOL> self . request . current_page = self . page <EOL> feed = CategoryFeed ( ) ( self . request , self . category1 . slug ) <EOL> self . assertContains ( feed , article . title ) <EOL> self . assertNotContains ( feed , different_category_article . title ) </s>
