aboutsummaryrefslogtreecommitdiff
path: root/src/tests/controllers/feed.py
blob: 7dd772959501c701e6af71f0430915c691565094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from tests.base import BasePyaggTest
from web.controllers import FeedController
from web.controllers import ArticleController


class FeedControllerTest(BasePyaggTest):
    _contr_cls = FeedController

    def test_feed_rights(self):
        feed = FeedController(2).read()[0].dump()
        self.assertTrue(3,
                ArticleController().read(feed_id=feed['id']).count())
        self._test_controller_rights(feed, feed['user_id'])
        # checking articles are deleted after the feed has been deleted

    def test_feed_article_deletion(self):
        feed_ctr = FeedController(2)
        feed = feed_ctr.read()[0].dump()
        feed_ctr.delete(feed['id'])
        self.assertFalse(0,
                ArticleController().read(feed_id=feed['id']).count())

    def test_feed_list_fetchable(self):
        self.assertEquals(3, len(FeedController(3).list_fetchable()))
        self.assertEquals(0, len(FeedController(3).list_fetchable()))
        self.assertEquals(3, len(FeedController().list_fetchable()))
        self.assertEquals(0, len(FeedController().list_fetchable()))
bgstack15