summaryrefslogtreecommitdiff
path: root/testing/tests/server/test_incoming_server.py
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-06-10 06:19:03 -0300
committerVictor Shyba <victor1984@riseup.net>2017-07-02 01:32:39 -0300
commitcbcc049737e26e30db8890e31d6b98725bdb3385 (patch)
treeccbd776729c2971da5764116d4ef2169b40fc4d4 /testing/tests/server/test_incoming_server.py
parent7ef11157c9af8dcddbc52f063f8f362bddc6c36f (diff)
[feature] add formatting from MX into incoming
Use the same formatting as MX was using for backwards compatibility. -- Resolves: #8828
Diffstat (limited to 'testing/tests/server/test_incoming_server.py')
-rw-r--r--testing/tests/server/test_incoming_server.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/testing/tests/server/test_incoming_server.py b/testing/tests/server/test_incoming_server.py
index 6e05206a..d0410520 100644
--- a/testing/tests/server/test_incoming_server.py
+++ b/testing/tests/server/test_incoming_server.py
@@ -26,6 +26,8 @@ from twisted.internet import defer
import treq
from leap.soledad.server._incoming import IncomingResource
+from leap.soledad.server._incoming import IncomingFormatter
+from leap.soledad.common.crypto import EncryptionSchemes
from test_soledad.util import CouchServerStateForTests
from test_soledad.util import CouchDBTestCase
@@ -49,9 +51,11 @@ class BlobServerTestCase(CouchDBTestCase):
@pytest.mark.usefixtures("method_tmpdir")
def test_put_incoming_creates_a_document(self):
user_id, doc_id = self.user_id, uuid4().hex
- incoming_endpoint = self.uri + '%s/%s' % (user_id, doc_id)
- yield treq.put(incoming_endpoint, BytesIO('{}'), persistent=False)
+ content, scheme = 'Hi', EncryptionSchemes.NONE
+ formatter = IncomingFormatter()
+ incoming_endpoint = self.uri + '%s/%s/%s' % (user_id, doc_id, scheme)
+ yield treq.put(incoming_endpoint, BytesIO(content), persistent=False)
db = self.state.open_database(user_id)
doc = db.get_doc(doc_id)
- self.assertEquals(doc.content, {})
+ self.assertEquals(doc.content, formatter.format(content, scheme))