コード例 #1
0
ファイル: test_tap.py プロジェクト: amitgandhinz/mimic
    def test_realtime(self):
        """
        The C{--realtime} option specifies that the global reactor ought to be
        used, so Mimic's time can be advanced by the passage of real time.
        """
        o = Options()
        o.parseOptions(["--realtime"])

        class CheckClock(MimicCore):
            @classmethod
            def fromPlugins(cls, clock):
                result = super(CheckClock, cls).fromPlugins(clock)
                CheckClock.clock = clock
                return result
        from mimic import tap
        self.patch(tap, "MimicCore", CheckClock)
        makeService(o)
        # Grab the global reactor just for comparison.
        from twisted.internet import reactor as real_reactor
        self.assertIdentical(CheckClock.clock, real_reactor)
コード例 #2
0
ファイル: test_tap.py プロジェクト: scouzigou/mimic
    def test_realtime(self):
        """
        The C{--realtime} option specifies that the global reactor ought to be
        used, so Mimic's time can be advanced by the passage of real time.
        """
        o = Options()
        o.parseOptions(["--realtime"])

        class CheckClock(MimicCore):
            @classmethod
            def fromPlugins(cls, clock):
                result = super(CheckClock, cls).fromPlugins(clock)
                CheckClock.clock = clock
                return result

        from mimic import tap
        self.patch(tap, "MimicCore", CheckClock)
        makeService(o)
        # Grab the global reactor just for comparison.
        from twisted.internet import reactor as real_reactor
        self.assertIdentical(CheckClock.clock, real_reactor)
コード例 #3
0
ファイル: test_tap.py プロジェクト: scouzigou/mimic
 def test_makeService(self):
     """
     makeService creates a service that, when listened upon, creates a Site.
     """
     o = Options()
     o.parseOptions(["--listen", "fake:"])
     thisFakeParser = FakeEndpointParser()
     addFakePluginObject(self, plugins, thisFakeParser)
     service = makeService(o)
     service.startService()
     self.assertEqual(len(thisFakeParser.endpoints), 1)
     endpoints = thisFakeParser.endpoints[0]
     self.assertEqual(len(endpoints.factories), 1)
     factory = endpoints.factories[0]
     self.assertEqual(factory.displayTracebacks, False)
コード例 #4
0
ファイル: test_tap.py プロジェクト: amitgandhinz/mimic
 def test_makeService(self):
     """
     makeService creates a service that, when listened upon, creates a Site.
     """
     o = Options()
     o.parseOptions(["--listen", "fake:"])
     thisFakeParser = FakeEndpointParser()
     addFakePluginObject(self, plugins, thisFakeParser)
     service = makeService(o)
     service.startService()
     self.assertEqual(len(thisFakeParser.endpoints), 1)
     endpoints = thisFakeParser.endpoints[0]
     self.assertEqual(len(endpoints.factories), 1)
     factory = endpoints.factories[0]
     self.assertEqual(factory.displayTracebacks, False)
コード例 #5
0
ファイル: test_tap.py プロジェクト: rahulb-rackspace/mimic
 def get_site(self, options_list):
     """
     Create the service, and get the site that was created.
     """
     o = Options()
     o.parseOptions(options_list)
     thisFakeParser = FakeEndpointParser()
     addFakePluginObject(self, plugins, thisFakeParser)
     service = makeService(o)
     service.startService()
     self.assertEqual(len(thisFakeParser.endpoints), 1)
     endpoints = thisFakeParser.endpoints[0]
     self.assertEqual(len(endpoints.factories), 1)
     factory = endpoints.factories[0]
     return factory
コード例 #6
0
ファイル: test_tap.py プロジェクト: raghav3259/mimic
 def get_site(self, options_list):
     """
     Create the service, and get the site that was created.
     """
     o = Options()
     o.parseOptions(options_list)
     thisFakeParser = FakeEndpointParser()
     addFakePluginObject(self, plugins, thisFakeParser)
     service = makeService(o)
     service.startService()
     self.assertEqual(len(thisFakeParser.endpoints), 1)
     endpoints = thisFakeParser.endpoints[0]
     self.assertEqual(len(endpoints.factories), 1)
     factory = endpoints.factories[0]
     return factory