summaryrefslogtreecommitdiff
path: root/test/manual/test_pageant.rb
blob: b07e82c264b6294be6d01f16ef6c86bbdda17aca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Tests for communication capability with Pageant (or KeeAgent)
# process, to include the case where it is running in different UAC
# context.
#
# To run:
# - Ensure that Pageant is running (not as administrator).
# - Open two command prompts, one as an administrator and one limited
#     (normal).
# - Within each, from the root net/ssh project directory, execute:
#       ruby -Ilib -Itest -rrubygems test/manual/test_pageant.rb
#

require_relative '../common'
require 'net/ssh/authentication/agent'

module Authentication
  class TestPageapnt < NetSSHTest
    def test_agent_should_be_able_to_negotiate
      begin
        agent.negotiate!
      rescue Net::SSH::Authentication::AgentNotAvailable
        puts "Test failing connect now!.... :#{$!}"
        sleep 1800
        raise
      end
    end

    private

    def agent(auto = :connect)
      @agent ||= begin
        agent = Net::SSH::Authentication::Agent.new
        agent.connect! if auto == :connect
        agent
      end
    end
  end
end