Пример #1
0
    def test_SRVNoResultUnknownServiceNoDefaultPort(self):
        """
        Connect fails on no result, unknown service and no default port.
        """
        self.connector = srvconnect.SRVConnector(self.reactor,
                                                 'thisbetternotexist',
                                                 'example.org', self.factory)

        client.theResolver.failure = ServiceNameUnknownError()
        self.connector.connect()

        self.assertTrue(self.factory.reason.check(ServiceNameUnknownError))
Пример #2
0
    def test_SRVNoResultUnknownServiceDefaultPort(self):
        """
        connectTCP gets called with default port if the service is not defined.
        """
        self.connector = srvconnect.SRVConnector(self.reactor,
                                                 'thisbetternotexist',
                                                 'example.org',
                                                 self.factory,
                                                 defaultPort=5222)

        client.theResolver.failure = ServiceNameUnknownError()
        self.connector.connect()

        self.assertIsNone(self.factory.reason)
        self.assertEqual(self.reactor.tcpClients.pop()[:2],
                         ('example.org', 5222))