def test_default_target_hosts(self): with patch('brotab.main.get_mediator_ports') as mocked: mocked.side_effect = [ range(self.mediator.port, self.mediator.port + 1) ] clients = create_clients() assert 1 == len(clients) assert self.mediator.port == clients[0]._port
def get_client(requested_browser=None): if requested_browser is None: requested_browser = default_browser clients = btm.create_clients() if not clients: raise Exception("No clients found!") browser_matches = [ cl for cl in clients if cl._get_browser() == requested_browser ] if not browser_matches: raise Exception("No clients found!") if len(browser_matches) > 1: raise Exception("Too many clients found, don't know what to do!") return browser_matches[0]
def test_two_custom_target_hosts(self): clients = create_clients('127.0.0.1:%d,localhost:%d' % (self.mediator.port, self.mediator.port)) assert 2 == len(clients) assert self.mediator.port == clients[0]._port assert self.mediator.port == clients[1]._port
def test_one_custom_target_hosts(self): clients = create_clients('127.0.0.1:%d' % self.mediator.port) assert 1 == len(clients) assert self.mediator.port == clients[0]._port
def get_api(): clients = create_clients() return MultipleMediatorsAPI(clients)