

def test_run(self):
    '\n        Given a valid port number and a test module, L{nit.run} starts logging\n        to stdout, starts a L{NevowSite} listening on the specified port\n        serving a L{TestFrameworkRoot}, and runs the reactor.\n        '

    class FakeReactor():

        def listenTCP(self, port, factory):
            events.append(('listen', port, factory))

        def run(self):
            events.append(('run',))
    events = []
    self.patch(nit, 'startLogging', (lambda out: events.append(('logging', out))))
    self.patch(nit, 'reactor', FakeReactor())
    self.patch(sys, 'argv', ['nit', '--port', '123', 'nevow'])
    nit.run()
    self.assertEqual(events[0], ('logging', sys.stdout))
    self.assertEqual(events[1][:2], ('listen', 123))
    self.assertTrue(isinstance(events[1][2], NevowSite))
    self.assertTrue(isinstance(events[1][2].resource, TestFrameworkRoot))
    self.assertEqual(events[2], ('run',))

dataset/ETHPy150Open twisted/nevow/nevow/test/test_nit.py NevowInteractiveTesterTest.test_run/original