test/lib/testhelper/auth.rb
def api_pw(server: nil, port: nil, user: nil)
      return @api_pw if @api_pw
      # If we're here, we need to get the pw via prompt
      @api_pw = prompt_for_password prompt: "Enter the API password for #{user}@#{server}:#{port}" do |apw|
        begin
          JSS.api.disconnect
          JSS.api.connect user: user, pw: apw, server: server, port: port
          true
        rescue JSS::AuthenticationError
          false
        end # begin
      end # do apw
      raise JSS::AuthenticationError, "Incorrect API password for #{user}@#{server}:#{port}" unless @api_pw
      @api_pw
    end
# return the user's API password, prompting for it if we don't already have
# it
#
return the user's API password, prompting for it if we don't already have
it
return the user ' s API password prompting for it if we don ' t already have it
def api_pw(server: nil, port: nil, user: nil)
      return @api_pw if @api_pw
      @api_pw = prompt_for_password prompt: "Enter the API password for #{user}@#{server}:#{port}" do |apw|
        begin
          JSS.api.disconnect
          JSS.api.connect user: user, pw: apw, server: server, port: port
          true
        rescue JSS::AuthenticationError
          false
        end 
      end 
      raise JSS::AuthenticationError, "Incorrect API password for #{user}@#{server}:#{port}" unless @api_pw
      @api_pw
    end
def api_pw ( server : nil , port : nil , user : nil ) return @api_pw if @api_pw @api_pw = prompt_for_password prompt : "Enter the API password for #{user}@#{server}:#{port}" do | apw | begin JSS . api . disconnect JSS . api . connect user : user , pw : apw , server : server , port : port true rescue JSS :: AuthenticationError false end end raise JSS :: AuthenticationError , "Incorrect API password for #{user}@#{server}:#{port}" unless @api_pw @api_pw end
return the user's API password, prompting for it if we don't already have
it
return the user ' s API password prompting for it if we don ' t already have it
# If we're here, we need to get the pw via prompt # begin # do apw
server
port
user