summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/soledad/server/_resource.py4
-rw-r--r--src/leap/soledad/server/url_mapper.py4
-rw-r--r--testing/tests/server/test__resource.py7
3 files changed, 15 insertions, 0 deletions
diff --git a/src/leap/soledad/server/_resource.py b/src/leap/soledad/server/_resource.py
index 49c4b742..28344b38 100644
--- a/src/leap/soledad/server/_resource.py
+++ b/src/leap/soledad/server/_resource.py
@@ -20,6 +20,7 @@ A twisted resource that serves the Soledad Server.
from twisted.web.resource import Resource
from ._server_info import ServerInfo
+from ._incoming import IncomingResource
from ._wsgi import get_sync_resource
@@ -75,6 +76,9 @@ class SoledadResource(Resource):
if blobs_resource:
self.putChild('blobs', blobs_resource)
+ # requests to /incoming goes into IncomingResource
+ self.putChild('incoming', IncomingResource())
+
# other requests are routed to legacy sync resource
self._sync_resource = get_sync_resource(sync_pool)
diff --git a/src/leap/soledad/server/url_mapper.py b/src/leap/soledad/server/url_mapper.py
index b50a81cd..137a5469 100644
--- a/src/leap/soledad/server/url_mapper.py
+++ b/src/leap/soledad/server/url_mapper.py
@@ -59,6 +59,7 @@ class URLMapper(object):
/user-{uuid}/sync-from/{source} | GET, PUT, POST
/blobs/{uuid}/{blob_id} | GET, PUT, POST
/blobs/{uuid} | GET
+ /incoming/ | PUT
"""
# auth info for global resource
self._connect('/', ['GET'])
@@ -75,3 +76,6 @@ class URLMapper(object):
# auth info for blobs resource
self._connect('/blobs/{uuid}/{blob_id}', ['GET', 'PUT'])
self._connect('/blobs/{uuid}', ['GET'])
+
+ # incoming resource
+ self._connect('/incoming/{uuid}/{incoming_id}', ['PUT'])
diff --git a/testing/tests/server/test__resource.py b/testing/tests/server/test__resource.py
index 1c0510b9..249b62f9 100644
--- a/testing/tests/server/test__resource.py
+++ b/testing/tests/server/test__resource.py
@@ -26,6 +26,7 @@ from twisted.internet import reactor
from leap.soledad.server._resource import SoledadResource
from leap.soledad.server._server_info import ServerInfo
from leap.soledad.server._blobs import BlobsResource
+from leap.soledad.server._incoming import IncomingResource
from leap.soledad.server.gzip_middleware import GzipMiddleware
@@ -68,3 +69,9 @@ class SoledadResourceTestCase(unittest.TestCase):
child = getChildForRequest(resource, request)
self.assertIsInstance(child, WSGIResource)
self.assertIsInstance(child._application, GzipMiddleware)
+
+ def test_get_incoming(self):
+ resource = SoledadResource(None, sync_pool=_pool)
+ request = DummyRequest(['incoming'])
+ child = getChildForRequest(resource, request)
+ self.assertIsInstance(child, IncomingResource)