aboutsummaryrefslogtreecommitdiff
path: root/tests/controllers/article.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/controllers/article.py')
-rw-r--r--tests/controllers/article.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/controllers/article.py b/tests/controllers/article.py
new file mode 100644
index 00000000..9a635fa7
--- /dev/null
+++ b/tests/controllers/article.py
@@ -0,0 +1,23 @@
+from tests.base import BasePyaggTest
+from pyaggr3g470r.controllers import ArticleController
+
+
+class ArticleControllerTest(BasePyaggTest):
+ _contr_cls = ArticleController
+
+ def test_controller(self):
+ article = ArticleController(2).read()[0].dump()
+ self.assertFalse(article['readed'])
+ article['readed'] = True # article get read when retreived through get
+ self._test_controller_rights(article, article['user_id'])
+ self.assertEquals(0, len(list(ArticleController().challenge(
+ [{'id': art.id} for art in ArticleController(3).read()]))))
+ self.assertEquals(9, len(list(ArticleController(2).challenge(
+ [{'id': art.id} for art in ArticleController(3).read()]))))
+ self.assertEquals(9, len(list(ArticleController(2).challenge(
+ [{'entry_id': art.id} for art in ArticleController(3).read()]
+ ))))
+ self.assertEquals({1: 2, 2: 3, 3: 3},
+ ArticleController(2).get_unread())
+ self.assertEquals({4: 3, 5: 3, 6: 3},
+ ArticleController(3).get_unread())
bgstack15