test/lib/testhelper/auth.rb
# return the server, port, and user, which we might have gotten fromthe keychain
return the server, port, and user, which we might have gotten fromthe keychain
return the server port and user which we might have gotten fromthe keychain
def connect_to_api(server: nil, user: nil, port: nil, pw: nil)
      return if JSS.api.connected?
      JSS.api.connect server: server, port: port, user: user, pw: pw
      @api_pw = pw
      { server: JSS.api.hostname, port: JSS.api.port, user: JSS.api.jss_user }
    rescue JSS::AuthenticationError
      pw = api_pw server: server, port: port, user: user
    ensure
      save_rw_credentials label: KEYCHAIN_JSS_LABEL, acct: JSS.api.jss_user, server: JSS.api.hostname, port: JSS.api.port, pw: pw if JSS.api.connected?
    end
def connect_to_api ( server : nil , user : nil , port : nil , pw : nil ) return if JSS . api . connected? JSS . api . connect server : server , port : port , user : user , pw : pw @api_pw = pw { server : JSS . api . hostname , port : JSS . api . port , user : JSS . api . jss_user } rescue JSS :: AuthenticationError pw = api_pw server : server , port : port , user : user ensure save_rw_credentials label : KEYCHAIN_JSS_LABEL , acct : JSS . api . jss_user , server : JSS . api . hostname , port : JSS . api . port , pw : pw if JSS . api . connected? end
return the server, port, and user, which we might have gotten fromthe keychain
return the server port and user which we might have gotten fromthe keychain
# If we're here, we need to prompt for the pw # store the pw
server
user
port
pw