def _createProberStubConnectAndProbe(self, requests, timeouts): """Create a ProberFactory object with a URL inside self.host and call its probe() method. Before the prober.probe() method is called, we stub the connect method, because all we want is to check whether that method was called or not --we don't want to actually connect. """ def connect(): prober.connectCalled = True distributionmirror_prober.host_requests = {self.host: requests} distributionmirror_prober.host_timeouts = {self.host: timeouts} prober = ProberFactory('http://%s/baz' % self.host) prober.connectCalled = False prober.failed = lambda error: None prober.connect = connect prober.probe() return prober
def _createProberStubConnectAndProbe(self, requests, timeouts): """Create a ProberFactory object with a URL inside self.host and call its probe() method. Before the prober.probe() method is called, we stub the connect method, because all we want is to check whether that method was called or not --we don't want to actually connect. """ def connect(): prober.connectCalled = True distributionmirror_prober.host_requests = {self.host: requests} distributionmirror_prober.host_timeouts = {self.host: timeouts} prober = ProberFactory('http://%s/baz' % self.host) prober.connectCalled = False prober.failed = lambda error: None prober.connect = connect prober.probe() return prober