diff options
Diffstat (limited to 'service/test/unit/resources/test_auth.py')
-rw-r--r-- | service/test/unit/resources/test_auth.py | 30 |
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 + |