Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More tests… save point.

Filling out more tests for ContextByID.
  • Loading branch information...
commit 7a19ebfab946a9bf746d5d2ca2a4edb73cde24d2 1 parent cb3e73d
Josh Finnie authored
Showing with 65 additions and 19 deletions.
  1. +65 −19 lumin/tests/test_node.py
View
84 lumin/tests/test_node.py
@@ -128,24 +128,70 @@ def test_ctor_default(self):
self.assertEquals(result._spec, {'_id': None})
self.assertEquals(result.data, {})
+ def test_get__acl__(self):
+ result = self._call_fut(request=self.request)
+ acl = result.get__acl__()
+ self.assertEquals(acl, [])
+
+ def test_set__acl__(self):
+ from pyramid.security import Allow
+ from pyramid.security import Everyone
+ test_acl = [
+ [Allow, Everyone, 'view'],
+ ]
+ result = self._call_fut(request=self.request)
+ result.set__acl__(test_acl)
+ self.assertEquals(result.__acl__, test_acl)
-class TestContextBySpec(unittest.TestCase):
- def setUp(self):
- self.config = pyramid.testing.setUp()
- self.request = pyramid.testing.DummyRequest()
-
- self.mock_conn = mongomock.Connection()
- self.request.db = mongomock.Database(self.mock_conn)
-
- def tearDown(self):
- pyramid.testing.tearDown()
-
- def _call_fut(self, request=None, _id=None, name=None, data=None):
- from lumin.node import ContextBySpec
- return ContextBySpec(request=request, _id=_id, name=name, data=data)
-
- def test_ctor_default(self):
+ def test_delete__acl__(self):
result = self._call_fut(request=self.request)
- self.assertEquals(result.__name__, None)
- self.assertEquals(result._spec, {'_id': None})
- self.assertEquals(result.data, {})
+ self.assertEquals(result.__acl__, [])
+
+ # TODO: Doesn't work yet.
+ # def test__acl__is_not_lst(self):
+ # result = self._call_fut(request=self.request)
+ # test_acl = 'string'
+ # mutator = []
+ # self.assertRaises(TypeError, result._acl_apply(test_acl, mutator=mutator))
+
+
+# TODO - Figure out how to mock HTTP for line 388 in node.py
+# class TestContextBySpec(unittest.TestCase):
+# def setUp(self):
+# self.config = pyramid.testing.setUp()
+# self.request = pyramid.testing.DummyRequest()
+
+# self.mock_conn = mongomock.Connection()
+# self.request.db = mongomock.Database(self.mock_conn)
+
+# def tearDown(self):
+# pyramid.testing.tearDown()
+
+# def _call_fut(self, request=None, _id='test', name=None, data=None):
+# from lumin.node import ContextBySpec
+# return ContextBySpec(request=request, _id=_id, name=name, data=data)
+
+# def test_ctor_default(self):
+# result = self._call_fut(request=self.request)
+# self.assertEquals(result.__name__, None)
+# self.assertEquals(result._spec, {'_id': None})
+# self.assertEquals(result.data, {})
+
+# def test_get__acl__(self):
+# result = self._call_fut(request=self.request)
+# acl = result.get__acl__()
+# self.assertEquals(acl, [])
+
+# def test_set__acl__(self):
+# from pyramid.security import Allow
+# from pyramid.security import Everyone
+# test_acl = [
+# [Allow, Everyone, 'view'],
+# ]
+# result = self._call_fut(request=self.request)
+# result.set__acl__(test_acl)
+# self.assertEquals(result.__acl__, test_acl)
+
+# def test_delete__acl__(self):
+# result = self._call_fut(request=self.request)
+# self.assertEquals(result.__acl__, None)
Please sign in to comment.
Something went wrong with that request. Please try again.