def _init_rest(ref_sso_url, ref_proof_key, success=True, message=None): def post_request(url, headers, body, **kwargs): _ = url _ = headers _ = body _ = kwargs.get('dummy') return { 'success': success, 'message': message, 'data': { 'ssoUrl': ref_sso_url, 'proofKey': ref_proof_key, } } connection = MagicMock() connection._login_timeout = 120 connection.errorhandler = Mock(return_value=None) type(connection).application = PropertyMock(return_value=CLIENT_NAME) type(connection)._internal_application_name = PropertyMock( return_value=CLIENT_NAME) type(connection)._internal_application_version = PropertyMock( return_value=CLIENT_VERSION) rest = SnowflakeRestful(host='testaccount.snowflakecomputing.com', port=443, connection=connection) rest._post_request = post_request return rest
def _init_rest(ref_sso_url, ref_token_url, success=True, message=None): def post_request(url, headers, body, **kwargs): _ = url _ = headers _ = body _ = kwargs.get("dummy") return { "success": success, "message": message, "data": { "ssoUrl": ref_sso_url, "tokenUrl": ref_token_url, }, } connection = MagicMock() connection._login_timeout = 120 connection._network_timeout = None connection.errorhandler = Mock(return_value=None) connection._ocsp_mode = Mock(return_value=OCSPMode.FAIL_OPEN) type(connection).application = PropertyMock(return_value=CLIENT_NAME) type(connection)._internal_application_name = PropertyMock( return_value=CLIENT_NAME) type(connection)._internal_application_version = PropertyMock( return_value=CLIENT_VERSION) rest = SnowflakeRestful(host="testaccount.snowflakecomputing.com", port=443, connection=connection) rest._post_request = post_request return rest
def _init_rest(application, post_requset): connection = MagicMock() connection._login_timeout = 120 connection.errorhandler = Mock(return_value=None) type(connection).application = PropertyMock(return_value=application) type(connection)._internal_application_name = PropertyMock( return_value=CLIENT_NAME) type(connection)._internal_application_version = PropertyMock( return_value=CLIENT_VERSION) rest = SnowflakeRestful(host='testaccount.snowflakecomputing.com', port=443, connection=connection) rest._post_request = post_requset return rest