summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorNavaL <ayoyo@thoughtworks.com>2016-02-25 12:18:31 +0100
committerNavaL <ayoyo@thoughtworks.com>2016-02-25 12:18:31 +0100
commit1e6518dd6577bf0dbec359fd4c1aec12ed6f2a64 (patch)
tree0f2bfea8d6f6c161481ca5365632ba8b0e69ccc9 /service
parent1e1668f98afd04e2da7c779a825e6d28e777fec7 (diff)
only adding feature resource in root_resource test -- fixing build
Issue #612
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/resources/root_resource.py30
-rw-r--r--service/test/unit/resources/test_root_resource.py3
2 files changed, 17 insertions, 16 deletions
diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py
index 2c32ab0c..86435d89 100644
--- a/service/pixelated/resources/root_resource.py
+++ b/service/pixelated/resources/root_resource.py
@@ -45,7 +45,7 @@ class RootResource(BaseResource):
self._static_folder = self._get_static_folder()
self._html_template = open(os.path.join(self._static_folder, 'index.html')).read()
self._services_factory = services_factory
- self.child_resources = ChildResourcesMap()
+ self._child_resources = ChildResourcesMap()
self._startup_mode()
def _startup_mode(self):
@@ -56,7 +56,7 @@ class RootResource(BaseResource):
if path == '':
return self
if self._is_xsrf_valid(request):
- return self.child_resources.get(path)
+ return self._child_resources.get(path)
return UnAuthorizedResource()
def _is_xsrf_valid(self, request):
@@ -75,19 +75,19 @@ class RootResource(BaseResource):
return csrf_input and csrf_input == xsrf_token
def initialize(self, portal=None, disclaimer_banner=None):
- self.child_resources.add('assets', File(self._static_folder))
- self.child_resources.add('keys', KeysResource(self._services_factory))
- self.child_resources.add(AttachmentsResource.BASE_URL, AttachmentsResource(self._services_factory))
- self.child_resources.add('contacts', ContactsResource(self._services_factory))
- self.child_resources.add('features', FeaturesResource(portal))
- self.child_resources.add('tags', TagsResource(self._services_factory))
- self.child_resources.add('mails', MailsResource(self._services_factory))
- self.child_resources.add('mail', MailResource(self._services_factory))
- self.child_resources.add('feedback', FeedbackResource(self._services_factory))
- self.child_resources.add('user-settings', UserSettingsResource(self._services_factory))
- self.child_resources.add(LoginResource.BASE_URL,
- LoginResource(self._services_factory, portal, disclaimer_banner=disclaimer_banner))
- self.child_resources.add(LogoutResource.BASE_URL, LogoutResource(self._services_factory))
+ self._child_resources.add('assets', File(self._static_folder))
+ self._child_resources.add('keys', KeysResource(self._services_factory))
+ self._child_resources.add(AttachmentsResource.BASE_URL, AttachmentsResource(self._services_factory))
+ self._child_resources.add('contacts', ContactsResource(self._services_factory))
+ self._child_resources.add('features', FeaturesResource(portal))
+ self._child_resources.add('tags', TagsResource(self._services_factory))
+ self._child_resources.add('mails', MailsResource(self._services_factory))
+ self._child_resources.add('mail', MailResource(self._services_factory))
+ self._child_resources.add('feedback', FeedbackResource(self._services_factory))
+ self._child_resources.add('user-settings', UserSettingsResource(self._services_factory))
+ self._child_resources.add(LoginResource.BASE_URL,
+ LoginResource(self._services_factory, portal, disclaimer_banner=disclaimer_banner))
+ self._child_resources.add(LogoutResource.BASE_URL, LogoutResource(self._services_factory))
self._mode = MODE_RUNNING
diff --git a/service/test/unit/resources/test_root_resource.py b/service/test/unit/resources/test_root_resource.py
index 53481f56..cc052d8b 100644
--- a/service/test/unit/resources/test_root_resource.py
+++ b/service/test/unit/resources/test_root_resource.py
@@ -5,6 +5,7 @@ from mock import MagicMock, patch
from mockito import mock, when, any as ANY
from pixelated.application import UserAgentMode
+from pixelated.resources.features_resource import FeaturesResource
from test.unit.resources import DummySite
from twisted.web.test.requesthelper import DummyRequest
from pixelated.resources.root_resource import RootResource, MODE_STARTUP, MODE_RUNNING
@@ -90,7 +91,7 @@ class TestRootResource(unittest.TestCase):
request = DummyRequest(['features'])
request.getCookie = MagicMock(return_value='irrelevant -- stubbed')
- self.root_resource.initialize()
+ self.root_resource._child_resources.add('features', FeaturesResource())
d = self.web.get(request)