summaryrefslogtreecommitdiff
path: root/service/test/unit/resources
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-11-21 18:57:26 +0100
committerRoald de Vries <rdevries@thoughtworks.com>2016-11-21 18:57:26 +0100
commitad1e8d322e98c50793749e87e56ace9cccc0ef18 (patch)
treef63fd7d4d9ab31c2c163602d3c8312536489d144 /service/test/unit/resources
parentae63265323f63e3287d59033748830c38d9e964e (diff)
add test stub for PixelatedAuthSessionWrapper
Diffstat (limited to 'service/test/unit/resources')
-rw-r--r--service/test/unit/resources/test_auth.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/service/test/unit/resources/test_auth.py b/service/test/unit/resources/test_auth.py
new file mode 100644
index 00000000..5f65e199
--- /dev/null
+++ b/service/test/unit/resources/test_auth.py
@@ -0,0 +1,30 @@
+import unittest
+
+from mockito import mock
+
+from test.unit.resources import DummySite
+from twisted.web.test.requesthelper import DummyRequest
+from pixelated.resources.auth import PixelatedAuthSessionWrapper
+
+
+class TestRootResource(unittest.TestCase):
+
+ def setUp(self):
+ self.portal = mock()
+ self.mock_root_resource = mock()
+ self.anonymous_resource = mock()
+ self.credential_factories = mock()
+
+ self.session_wrapper = PixelatedAuthSessionWrapper(self.portal, self.mock_root_resource, self.anonymous_resource, self.credential_factories)
+ self.web = DummySite(self.session_wrapper)
+
+ def test_should_use_login_resource_when_the_user_is_not_logged_in (self):
+ request = DummyRequest([''])
+ self.session_wrapper.getChildWithDefault('/', request)
+
+ def assert_response(_):
+ self.assertEquals(len(matches), 1)
+
+ d.addCallback(assert_response)
+ return d
+