diff options
-rw-r--r-- | server/src/leap/soledad/server/_incoming.py | 5 | ||||
-rw-r--r-- | testing/tests/server/test_incoming_resource.py | 4 | ||||
-rw-r--r-- | testing/tests/server/test_incoming_server.py | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/server/src/leap/soledad/server/_incoming.py b/server/src/leap/soledad/server/_incoming.py index 1f74a6e4..6fd91a08 100644 --- a/server/src/leap/soledad/server/_incoming.py +++ b/server/src/leap/soledad/server/_incoming.py @@ -27,7 +27,6 @@ from leap.soledad.common.crypto import EncryptionSchemes __all__ = ['IncomingResource'] -ACCEPTED_SCHEMES = [EncryptionSchemes.NONE, EncryptionSchemes.PUBKEY] def _default_backend(): @@ -43,8 +42,8 @@ class IncomingResource(Resource): self.formatter = IncomingFormatter() def render_PUT(self, request): - uuid, doc_id, scheme = request.postpath - assert scheme in ACCEPTED_SCHEMES + uuid, doc_id = request.postpath + scheme = EncryptionSchemes.PUBKEY db = self.factory.open_database(uuid) doc = ServerDocument(doc_id) doc.content = self.formatter.format(request.content.read(), scheme) diff --git a/testing/tests/server/test_incoming_resource.py b/testing/tests/server/test_incoming_resource.py index e9148b4a..16e1e720 100644 --- a/testing/tests/server/test_incoming_resource.py +++ b/testing/tests/server/test_incoming_resource.py @@ -38,9 +38,9 @@ class IncomingResourceTestCase(unittest.TestCase): def test_save_document(self): formatter = IncomingFormatter() - doc_id, scheme = uuid4().hex, EncryptionSchemes.NONE + doc_id, scheme = uuid4().hex, EncryptionSchemes.PUBKEY content = 'Incoming content' - request = DummyRequest([self.user_uuid, doc_id, scheme]) + request = DummyRequest([self.user_uuid, doc_id]) request.content = BytesIO(content) self.resource.render_PUT(request) diff --git a/testing/tests/server/test_incoming_server.py b/testing/tests/server/test_incoming_server.py index afb0c970..64ac4353 100644 --- a/testing/tests/server/test_incoming_server.py +++ b/testing/tests/server/test_incoming_server.py @@ -51,9 +51,9 @@ class IncomingServerTestCase(CouchDBTestCase): @pytest.mark.usefixtures("method_tmpdir") def test_put_incoming_creates_a_document(self): user_id, doc_id = self.user_id, uuid4().hex - content, scheme = 'Hi', EncryptionSchemes.NONE + content, scheme = 'Hi', EncryptionSchemes.PUBKEY formatter = IncomingFormatter() - incoming_endpoint = self.uri + '%s/%s/%s' % (user_id, doc_id, scheme) + incoming_endpoint = self.uri + '%s/%s' % (user_id, doc_id) yield treq.put(incoming_endpoint, BytesIO(content), persistent=False) db = self.state.open_database(user_id) |