Esempio n. 1
0
 def setUp(self):
     self.stdin = StringIO()
     self.stdout = StringIO()
     self.rpc = rpc.JSONRPCServer(self.stdin, self.stdout)
Esempio n. 2
0
 def setUp(self):
     self.stdin = StringIO()
     self.stdout = StringIO()
     self.rpc = rpc.JSONRPCServer(self.stdin, self.stdout)
Esempio n. 3
0
class TestJSONRPCServer(unittest.TestCase):
    def setUp(self):
        self.stdin = StringIO()
        self.stdout = StringIO()
        self.rpc = rpc.JSONRPCServer(self.stdin, self.stdout)

    def write(self, s):
        self.stdin.seek(0)
        self.stdin.truncate()
        self.stdout.seek(0)
        self.stdout.truncate()
        self.stdin.write(s)
        self.stdin.seek(0)

    def read(self):
        value = self.stdout.getvalue()
        self.stdin.seek(0)
        self.stdin.truncate()
        self.stdout.seek(0)
        self.stdout.truncate()
        return value
Esempio n. 4
0
class TestJSONRPCServer(unittest.TestCase):
    def setUp(self):
        self.stdin = StringIO()
        self.stdout = StringIO()
        self.rpc = rpc.JSONRPCServer(self.stdin, self.stdout)

    def write(self, s):
        self.stdin.seek(0)
        self.stdin.truncate()
        self.stdout.seek(0)
        self.stdout.truncate()
        self.stdin.write(s)
        self.stdin.seek(0)

    def read(self):
        value = self.stdout.getvalue()
        self.stdin.seek(0)
        self.stdin.truncate()
        self.stdout.seek(0)
        self.stdout.truncate()
        return value