def __init__(self): """ Creates a new (possibly disabled) Eyes instance that interacts with the Eyes server. """ self._config_provider = Configuration() self._server_connector = ServerConnector() # type: ServerConnector self._user_inputs = [] # type: UserInputs self._debug_screenshot_provider = NullDebugScreenshotProvider()
def test_request_with_changed_values(configured_connector): new_timeout = 99999 new_timeout_sec = int(new_timeout / 1000.0) new_api_key = "NEW API KEY" new_server_url = "http://new-server.com/" conf = Configuration(timeout=new_timeout, api_key=new_api_key, server_url=new_server_url) configured_connector.update_config(conf) with patch("requests.post") as mocked_post: with patch( "applitools.core.server_connector.json_utils.attr_from_response", return_value=RUNNING_SESSION_OBJ, ): configured_connector.start_session(SESSION_START_INFO_OBJ) assert mocked_post.call_args[1]["timeout"] == new_timeout_sec assert mocked_post.call_args[1]["params"]["apiKey"] == new_api_key assert new_server_url in mocked_post.call_args[0][0]
def test_get_api_key_if_not_settled(connector, monkeypatch): # type: (ServerConnector, Any) -> None monkeypatch.setattr(os, "environ", {"APPLITOOLS_API_KEY": API_KEY}) conf = Configuration() connector.update_config(conf) assert connector.api_key == API_KEY
def test_check_default_server_url_from_settings(): connector = ServerConnector() conf = Configuration() connector.update_config(conf) assert connector.server_url == DEFAULT_SERVER_URL