Beispiel #1
0
#
# You should have received a copy of the GNU General Public License
# along with Spark; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

from __future__ import absolute_import
import unittest
import copy
import sys
import os
from spark.core import Future, TaskFailedError, Process
from spark.messaging import *
from spark.tests.common import run_tests, processTimeout, assertMatch, testFilePath
from io import BytesIO

TestFile = testFilePath('ProtocolTest.log')
TestText = b"""0025 > list-files 0 [{"register": true}]
007f < list-files 0 [{"<guid>": {"id": "<guid>", "last-modified": "20090619T173529.000Z", "name": "Report.pdf", "size": 3145728}}]
007e ! file-added 55 [{"id": "<guid>", "last-modified": "20090619T173529.000Z", "name": "SeisRoX-2.0.9660.exe", "size": 3145728}]
0068 > create-transfer 26 [{"blocksize": 1024, "file-id": "<guid>", "ranges": [{"end": 3071, "start": 0}]}]
0037 < create-transfer 26 [{"id": 2, "state": "inactive"}]
0021 > start-transfer 27 [{"id": 2}]
0036 < start-transfer 27 [{"id": 2, "state": "starting"}]
003c ! transfer-state-changed 56 [{"id": 2, "state": "active"}]
0018 \x00\x01\x00\x02\x00\x00\x00\x00\x00\x0cHello, world
0018 \x00\x01\x00\x02\x00\x00\x00\x01\x00\x0cSpaces      
040c \x00\x01\x00\x02\x00\x00\x0b\xff\x04\x00""" + (b"!" * 1024) + b"""
0021 > close-transfer 28 [{"id": 2}]
0020 < close-transfer 28 [{"id": 2}]"""

TestItems = [
Beispiel #2
0
 def __init__(self, receiverClass, cert_path, key_path):
     self.receiverClass = receiverClass
     cert = OpenPGPCertificate(open(testFilePath(cert_path)).read())
     key = OpenPGPPrivateKey(open(testFilePath(key_path)).read())
     super(TestSecureTcpSocket, self).__init__(cert, key)