aboutsummaryrefslogtreecommitdiff
path: root/tests/controllers
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-04-24 19:05:14 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-05-15 00:22:08 +0200
commit804d6fc6b9268577dbfd85f169f1a3f58e5cd6bc (patch)
treee6926a2734cc48d9160071c7238bf25ed0c6e108 /tests/controllers
parentcorrecting log level for error in feed retrieving (diff)
downloadnewspipe-804d6fc6b9268577dbfd85f169f1a3f58e5cd6bc.tar.gz
newspipe-804d6fc6b9268577dbfd85f169f1a3f58e5cd6bc.tar.bz2
newspipe-804d6fc6b9268577dbfd85f169f1a3f58e5cd6bc.zip
adding base unittests
Diffstat (limited to 'tests/controllers')
-rw-r--r--tests/controllers/__init__.py5
-rw-r--r--tests/controllers/article.py12
-rw-r--r--tests/controllers/feed.py15
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/controllers/__init__.py b/tests/controllers/__init__.py
new file mode 100644
index 00000000..26922c43
--- /dev/null
+++ b/tests/controllers/__init__.py
@@ -0,0 +1,5 @@
+from tests.controllers.feed import FeedControllerTest
+from tests.controllers.article import ArticleControllerTest
+
+
+__all__ = ['FeedControllerTest', 'ArticleControllerTest']
diff --git a/tests/controllers/article.py b/tests/controllers/article.py
new file mode 100644
index 00000000..b6c5225c
--- /dev/null
+++ b/tests/controllers/article.py
@@ -0,0 +1,12 @@
+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'])
diff --git a/tests/controllers/feed.py b/tests/controllers/feed.py
new file mode 100644
index 00000000..d8d6378b
--- /dev/null
+++ b/tests/controllers/feed.py
@@ -0,0 +1,15 @@
+from tests.base import BasePyaggTest
+from pyaggr3g470r.controllers import FeedController
+from pyaggr3g470r.controllers import ArticleController
+
+
+class FeedControllerTest(BasePyaggTest):
+ _contr_cls = FeedController
+
+ def test_controller(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
+ self.assertFalse(0,
+ ArticleController().read(feed_id=feed['id']).count())
bgstack15