Esempio n. 1
0
    def test_8bitReceiving(self):
        d = defer.Deferred()
        rvr = client.ResponseReceiver(d, decode_utf8=False)

        data = util.eight_bit_test_string()
        d.addCallback(lambda out: self.assertEqual(out, data))

        for c in data:
            rvr.dataReceived(c)

        rvr.connectionLost(Failure(ResponseDone()))
Esempio n. 2
0
    def test_8bitReceiving(self):
        d = defer.Deferred()
        rvr = client.ResponseReceiver(d, decode_utf8=False)

        data = util.eight_bit_test_string()
        d.addCallback(lambda out: self.assertEqual(out, data))

        for c in data:
            rvr.dataReceived(c)

        rvr.connectionLost(Failure(ResponseDone()))
Esempio n. 3
0
    def test_openDocAttachment(self):
        """
        Test opening an attachment with openDoc.
        """
        attachment_name = 'bindata.dat'
        attachment_data = util.eight_bit_test_string()

        doc_id = 'foo'
        body = {"value": "mybody"}
        self.db.addAttachments(body, {attachment_name: attachment_data})

        yield self._saveDoc(body, doc_id)

        retrieved_data = yield self.db.openDoc(self.db_name, doc_id,
            attachment=attachment_name)
        self.assertEquals(retrieved_data, attachment_data)
Esempio n. 4
0
    def test_openDocAttachment(self):
        """
        Test opening an attachment with openDoc.
        """
        attachment_name = 'bindata.dat'
        attachment_data = util.eight_bit_test_string()

        doc_id = 'foo'
        body = {"value": "mybody"}
        self.db.addAttachments(body, {attachment_name: attachment_data})

        yield self._saveDoc(body, doc_id)

        retrieved_data = yield self.db.openDoc(self.db_name,
                                               doc_id,
                                               attachment=attachment_name)
        self.assertEquals(retrieved_data, attachment_data)