aboutsummaryrefslogtreecommitdiff
path: root/src/tests/base.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-17 08:30:06 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-17 08:30:06 +0100
commitb0e987fbafaa28226c54157fb11993079c5341e2 (patch)
tree1f0cd04a505dce4680155f8bb4c7bb757984c030 /src/tests/base.py
parentBugfix: should import Article in order to resolve the 'date' column for the o... (diff)
downloadnewspipe-b0e987fbafaa28226c54157fb11993079c5341e2.tar.gz
newspipe-b0e987fbafaa28226c54157fb11993079c5341e2.tar.bz2
newspipe-b0e987fbafaa28226c54157fb11993079c5341e2.zip
cleaning the mess in the libs directories
Diffstat (limited to 'src/tests/base.py')
-rw-r--r--src/tests/base.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/tests/base.py b/src/tests/base.py
deleted file mode 100644
index d6f62583..00000000
--- a/src/tests/base.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import os
-os.environ['PYAGG_TESTING'] = 'true'
-
-import unittest
-from bootstrap import db
-import runserver
-from tests.fixtures import populate_db, reset_db
-from werkzeug.exceptions import NotFound
-
-
-class BasePyaggTest(unittest.TestCase):
- _contr_cls = None
-
- def _get_from_contr(self, obj_id, user_id=None):
- return self._contr_cls(user_id).get(id=obj_id).dump()
-
- def _test_controller_rights(self, obj, user_id):
- obj_id = obj['id']
- self.assertEquals(obj, self._get_from_contr(obj_id))
- self.assertEquals(obj, self._get_from_contr(obj_id, user_id))
- # fetching non existent object
- self.assertRaises(NotFound, self._get_from_contr, 99, user_id)
- # fetching object with inexistent user
- self.assertRaises(NotFound, self._get_from_contr, obj_id, 99)
- # fetching object with wrong user
- self.assertRaises(NotFound, self._get_from_contr, obj_id, user_id + 1)
- self.assertRaises(NotFound, self._contr_cls().delete, 99)
- self.assertRaises(NotFound, self._contr_cls(user_id).delete, 99)
- self.assertEquals(obj['id'],
- self._contr_cls(user_id).delete(obj_id).id)
- self.assertRaises(NotFound, self._contr_cls(user_id).delete, obj_id)
-
- def setUp(self):
- populate_db(db)
-
- def tearDown(self):
- reset_db(db)
-
-
-if __name__ == '__main__':
- unittest.main()
bgstack15