def test_run(self): edge = EdgeServer(('127.0.0.1', 0), None) self.mox.StubOutWithMock(edge.server, 'start') self.mox.StubOutWithMock(edge.server, 'serve_forever') edge.server.start() edge.server.serve_forever() self.mox.ReplayAll() edge._run()
def test_handle(self): queue = self.mox.CreateMockAnything() sock = self.mox.CreateMockAnything() edge = EdgeServer(('127.0.0.1', 0), queue) self.mox.StubOutWithMock(edge, 'handle') sock.fileno().AndReturn(15) edge.handle(sock, 'test address') self.mox.ReplayAll() try: edge.server.pre_start() except AttributeError: edge.server.init_socket() edge._handle(sock, 'test address')
def test_kill(self): edge = EdgeServer(('127.0.0.1', 0), None) self.mox.StubOutWithMock(edge.server, 'stop') edge.server.stop() self.mox.ReplayAll() edge.kill()
def test_edge_interface(self): edge = EdgeServer(('127.0.0.1', 0), None) with self.assertRaises(NotImplementedError): edge.handle(None, None)