class OtherTests(unittest.TestCase): def setUp(self): self.proxy = Proxy() self.proxy._proxyfd = MockFd() def tearDown(self): UnmockClassMethods(Proxy) UnmockClassMethods(Server) def testProcessInputNonProxyPort(self): fd = MockFd(fd=111) MockClassMethod(Server, "_ProcessInput") self.proxy._ProcessInput(fd) self.assertEqual(self.proxy.called, [("_ProcessInput", (fd,), {})]) def testProcessInput(self): MockClassMethod(Proxy, "_GrabPacket") MockClassMethod(Proxy, "_HandleProxyPacket") self.proxy._ProcessInput(self.proxy._proxyfd) self.assertEqual([x[0] for x in self.proxy.called], ["_GrabPacket", "_HandleProxyPacket"])
class OtherTests(unittest.TestCase): def setUp(self): self.proxy = Proxy() self.proxy._proxyfd = MockFd() def tearDown(self): UnmockClassMethods(Proxy) UnmockClassMethods(Server) def testProcessInputNonProxyPort(self): fd = MockFd(fd=111) MockClassMethod(Server, '_ProcessInput') self.proxy._ProcessInput(fd) self.assertEqual(self.proxy.called, [('_ProcessInput', (fd, ), {})]) def testProcessInput(self): MockClassMethod(Proxy, '_GrabPacket') MockClassMethod(Proxy, '_HandleProxyPacket') self.proxy._ProcessInput(self.proxy._proxyfd) self.assertEqual([x[0] for x in self.proxy.called], ['_GrabPacket', '_HandleProxyPacket'])