@@ -129,7 +129,7 @@ defmodule SSHKit.ConnectionTest do
129
129
end )
130
130
131
131
conn = % Connection {
132
- host: 'foo .io' ,
132
+ host: 'test .io' ,
133
133
port: 22 ,
134
134
options: [ user_interaction: false ] ,
135
135
ref: :connection_ref
@@ -140,7 +140,7 @@ defmodule SSHKit.ConnectionTest do
140
140
end
141
141
142
142
describe "reopen/2" do
143
- test "opens a new connection with the same options as the existing connection" do
143
+ test "opens a new connection with the same options as an existing connection" do
144
144
conn = % Connection {
145
145
host: 'test.io' ,
146
146
port: 22 ,
@@ -160,7 +160,7 @@ defmodule SSHKit.ConnectionTest do
160
160
assert reopen ( conn ) == { :ok , new_conn }
161
161
end
162
162
163
- test "reopens a connection on new port" do
163
+ test "reopens a connection on a new port" do
164
164
conn = % Connection {
165
165
host: 'test.io' ,
166
166
port: 22 ,
@@ -178,12 +178,12 @@ defmodule SSHKit.ConnectionTest do
178
178
assert reopen ( conn , port: 666 ) == { :ok , new_conn }
179
179
end
180
180
181
- test "errors when unable to open connection" do
181
+ test "errors when unable to open a connection" do
182
182
conn = % Connection {
183
183
host: 'test.io' ,
184
184
port: 22 ,
185
- options: [ user_interaction: false ] ,
186
- ref: :sandbox
185
+ options: [ ] ,
186
+ ref: :connection_ref
187
187
}
188
188
189
189
expect ( @ core , :connect , fn _ , _ , _ , _ ->
@@ -193,4 +193,30 @@ defmodule SSHKit.ConnectionTest do
193
193
assert reopen ( conn ) == { :error , :failed }
194
194
end
195
195
end
196
+
197
+ describe "info/1" do
198
+ test "returns information about a connection" do
199
+ if function_exported? ( @ core , :connection_info , 1 ) do
200
+ expect ( @ core , :connection_info , fn ref ->
201
+ assert ref == :connection_ref
202
+ [ info: :test ]
203
+ end )
204
+ else
205
+ expect ( @ core , :connection_info , fn ref , keys ->
206
+ assert ref == :connection_ref
207
+ assert keys == [ :client_version , :server_version , :user , :peer , :sockname ]
208
+ [ info: :test ]
209
+ end )
210
+ end
211
+
212
+ conn = % Connection {
213
+ host: 'test.io' ,
214
+ port: 22 ,
215
+ options: [ ] ,
216
+ ref: :connection_ref
217
+ }
218
+
219
+ assert info ( conn ) == [ info: :test ]
220
+ end
221
+ end
196
222
end
0 commit comments