def test_select_best_url(self): cache_factory = CacheFactory(options={}, log=self.log, stable_name='test', pinger=self.pinger, resolver=self.resolver) spec = '{0}|{1}/path/to|{2}/path/'.format(self.REMOTE_URI_1, self.REMOTE_URI_2, self.REMOTE_URI_3) best = cache_factory.select_best_url(spec) self.assertEquals('{0}/path/to'.format(self.REMOTE_URI_2), best)
def test_select_best_url(self): log = MockLogger() pinger = MockPinger({'host1': 5, 'host2:666': 3, 'host3': 7}) cache_factory = CacheFactory(options={}, log=log, stable_name='test', pinger=pinger) spec = 'http://host1|https://host2:666/path/to|http://host3/path/' best = cache_factory.select_best_url(spec) self.assertEquals('https://host2:666/path/to', best)
def test_select_best_url(self): cache_factory = CacheFactory(options={}, log=self.log, stable_name='test', pinger=self.pinger, resolver=self.resolver) spec = '{0}|{1}/path/to|{2}/path/'.format(self.REMOTE_URI_1, self.REMOTE_URI_2, self.REMOTE_URI_3) best = cache_factory.select_best_url(spec) self.assertEquals('{0}/path/to'.format(self.REMOTE_URI_2), best)
def test_select_best_url(self): log = MockLogger() pinger = MockPinger({'host1': 5, 'host2:666': 3, 'host3': 7}) cache_factory = CacheFactory(options={}, log=log, stable_name='test', pinger=pinger) spec = 'http://host1|https://host2:666/path/to|http://host3/path/' best = cache_factory.select_best_url(spec) self.assertEquals('https://host2:666/path/to', best)