blob: 0a909a79b2f566027c6dcc293baf3cd15f38e75c (
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
40
41
42
43
|
require_relative '../common'
require 'net/ssh/authentication/agent'
module Authentication
unless RUBY_PLATFORM == "java"
class TestPageapnt < NetSSHTest
def with_pagent
pageant_path = 'C:\ProgramData\chocolatey\lib\putty.portable\tools\pageant.exe'
raise "No pageant found at:#{pageant_path}" unless File.executable?(pageant_path)
pageant_pid = Process.spawn(pageant_path)
sleep 4
yield
ensure
Process.kill(9, pageant_pid)
end
def test_agent_should_be_able_to_negotiate_with_pagent
with_pagent do
agent.negotiate!
end
end
def test_agent_should_raise_without_pagent
assert_raises Net::SSH::Authentication::AgentNotAvailable do
agent.negotiate!
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
end
|