summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoald de Vries <rdevries@thoughtworks.com>2016-12-05 10:56:24 +0100
committerRoald de Vries <rdevries@thoughtworks.com>2016-12-05 10:56:24 +0100
commitae871e84f6de213f01299f2754fb2e68d4a3afe2 (patch)
tree75ea49f16d9e9d2bc1e2a7691d4ce9bb49e967a0 /service
parented69fa3b7bf0b543b6c5d3f41504965a1b085808 (diff)
remove templates folder from root resource parameters
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/application.py8
-rw-r--r--service/pixelated/resources/root_resource.py2
-rw-r--r--service/test/support/integration/app_test_client.py4
-rw-r--r--service/test/support/integration/multi_user_client.py4
-rw-r--r--service/test/unit/resources/test_auth.py6
-rw-r--r--service/test/unit/resources/test_root_resource.py6
6 files changed, 13 insertions, 17 deletions
diff --git a/service/pixelated/application.py b/service/pixelated/application.py
index 7263482d..1dc38d3c 100644
--- a/service/pixelated/application.py
+++ b/service/pixelated/application.py
@@ -42,10 +42,6 @@ from pixelated.resources.root_resource import RootResource
log = Logger()
-def get_templates_folder():
- return os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates")
-
-
def get_static_folder():
# TODO: make sure sandbox keeps working
# TODO: make sure this works for packaging
@@ -103,7 +99,7 @@ def initialize():
args = arguments.parse_user_agent_args()
logger.init(debug=args.debug)
services_factory = _create_service_factory(args)
- resource = RootResource(services_factory, templates_folder=get_templates_folder(), static_folder=get_static_folder())
+ resource = RootResource(services_factory, static_folder=get_static_folder())
def start():
start_async = _start_mode(args, resource, services_factory)
@@ -164,7 +160,7 @@ def _setup_multi_user(args, root_resource, services_factory):
def set_up_protected_resources(root_resource, provider, services_factory, banner=None, authenticator=None):
session_checker = SessionChecker(services_factory)
- anonymous_resource = RootResource(services_factory, templates_folder=get_templates_folder(), static_folder=get_static_folder(), public=True)
+ anonymous_resource = RootResource(services_factory, static_folder=get_static_folder(), public=True)
realm = PixelatedRealm(root_resource, anonymous_resource)
_portal = portal.Portal(realm, [session_checker, AllowAnonymousAccess()])
diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py
index 8253a5c1..5cc93dbe 100644
--- a/service/pixelated/resources/root_resource.py
+++ b/service/pixelated/resources/root_resource.py
@@ -45,7 +45,7 @@ logger = Logger()
class RootResource(BaseResource):
- def __init__(self, services_factory, templates_folder, static_folder, public=False):
+ def __init__(self, services_factory, static_folder, public=False):
BaseResource.__init__(self, services_factory)
self._public = public
self._static_folder = static_folder
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index c611fbd0..1421b96b 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -38,7 +38,7 @@ from leap.soledad.client import Soledad
from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor
from pixelated.adapter.mailstore.leap_attachment_store import LeapAttachmentStore
from pixelated.adapter.services.feedback_service import FeedbackService
-from pixelated.application import UserAgentMode, set_up_protected_resources, get_static_folder, get_templates_folder
+from pixelated.application import UserAgentMode, set_up_protected_resources, get_static_folder
from pixelated.config.sessions import LeapSession
from pixelated.config.services import Services, ServicesFactory, SingleUserServicesFactory
from pixelated.config.site import PixelatedSite
@@ -218,7 +218,7 @@ class AppTestClient(object):
services = self._test_account.services
self.service_factory.add_session('someuserid', services)
- self.resource = RootResource(self.service_factory, get_templates_folder(), get_static_folder())
+ self.resource = RootResource(self.service_factory, get_static_folder())
provider = mock()
self.resource.initialize(provider)
else:
diff --git a/service/test/support/integration/multi_user_client.py b/service/test/support/integration/multi_user_client.py
index d7ab77a0..de272e16 100644
--- a/service/test/support/integration/multi_user_client.py
+++ b/service/test/support/integration/multi_user_client.py
@@ -19,7 +19,7 @@ from mockito import mock, when, any as ANY
from pixelated.authentication import Authenticator, Authentication
from twisted.internet import defer
-from pixelated.application import UserAgentMode, set_up_protected_resources, get_static_folder, get_templates_folder
+from pixelated.application import UserAgentMode, set_up_protected_resources, get_static_folder
from pixelated.config.services import ServicesFactory
from pixelated.config.sessions import LeapSessionFactory
@@ -46,7 +46,7 @@ class MultiUserClient(AppTestClient):
self.service_factory = ServicesFactory(UserAgentMode(is_single_user=False))
- root_resource = RootResource(self.service_factory, get_templates_folder(), get_static_folder())
+ root_resource = RootResource(self.service_factory, get_static_folder())
leap_provider = mock()
self.credentials_checker = StubSRPChecker(leap_provider)
self.resource = set_up_protected_resources(root_resource, leap_provider, self.service_factory)
diff --git a/service/test/unit/resources/test_auth.py b/service/test/unit/resources/test_auth.py
index 7112ed96..b43ab15e 100644
--- a/service/test/unit/resources/test_auth.py
+++ b/service/test/unit/resources/test_auth.py
@@ -1,6 +1,6 @@
from mockito import mock, when, any as ANY
-from pixelated.application import get_templates_folder, get_static_folder
+from pixelated.application import get_static_folder
from pixelated.resources.auth import SessionChecker, PixelatedRealm, PixelatedAuthSessionWrapper
from pixelated.resources.login_resource import LoginResource
from pixelated.resources.root_resource import RootResource
@@ -42,8 +42,8 @@ class TestPixelatedAuthSessionWrapper(unittest.TestCase):
session_checker = SessionChecker(services_factory)
self.portal = Portal(self.realm_mock, [session_checker, AllowAnonymousAccess()])
self.user_uuid_mock = mock()
- self.root_resource = RootResource(services_factory, get_templates_folder(), get_static_folder())
- self.anonymous_resource = RootResource(services_factory, get_templates_folder(), get_static_folder(), public=True)
+ self.root_resource = RootResource(services_factory, get_static_folder())
+ self.anonymous_resource = RootResource(services_factory, get_static_folder(), public=True)
self.session_wrapper = PixelatedAuthSessionWrapper(self.portal, self.root_resource, self.anonymous_resource)
self.request = DummyRequest([])
diff --git a/service/test/unit/resources/test_root_resource.py b/service/test/unit/resources/test_root_resource.py
index d42a4b38..4c9af052 100644
--- a/service/test/unit/resources/test_root_resource.py
+++ b/service/test/unit/resources/test_root_resource.py
@@ -5,7 +5,7 @@ from mock import MagicMock, patch
from mockito import mock, when, any as ANY
import pixelated
-from pixelated.application import UserAgentMode, get_templates_folder, get_static_folder
+from pixelated.application import UserAgentMode, get_static_folder
from pixelated.resources import IPixelatedSession, UnAuthorizedResource
from pixelated.resources.features_resource import FeaturesResource
from pixelated.resources.login_resource import LoginResource
@@ -22,7 +22,7 @@ from pixelated.resources.root_resource import InboxResource, RootResource, MODE_
class TestPublicRootResource(unittest.TestCase):
def setUp(self):
- self.public_root_resource = RootResource(mock(), get_templates_folder(), get_static_folder(), public=True)
+ self.public_root_resource = RootResource(mock(), get_static_folder(), public=True)
self.web = DummySite(self.public_root_resource)
@patch('pixelated.resources.mails_resource.events.register')
@@ -105,7 +105,7 @@ class TestRootResource(unittest.TestCase):
when(self.services_factory).services(ANY()).thenReturn(self.services)
self.mail_service.account_email = self.MAIL_ADDRESS
- self.root_resource = RootResource(self.services_factory, get_templates_folder(), get_static_folder())
+ self.root_resource = RootResource(self.services_factory, get_static_folder())
self.web = DummySite(self.root_resource)
@patch('pixelated.resources.mails_resource.events.register')