diff options
Diffstat (limited to 'tests/all')
-rw-r--r-- | tests/all/agent.rs | 5 | ||||
-rw-r--r-- | tests/all/knownhosts.rs | 22 | ||||
-rw-r--r-- | tests/all/main.rs | 3 | ||||
-rw-r--r-- | tests/all/session.rs | 2 |
4 files changed, 18 insertions, 14 deletions
diff --git a/tests/all/agent.rs b/tests/all/agent.rs index 8feee06..b3a7963 100644 --- a/tests/all/agent.rs +++ b/tests/all/agent.rs @@ -7,9 +7,8 @@ fn smoke() { agent.connect().unwrap(); agent.list_identities().unwrap(); { - let mut a = agent.identities(); - let i1 = a.next().unwrap().unwrap(); - a.count(); + let a = agent.identities().unwrap(); + let i1 = &a[0]; assert!(agent.userauth("foo", &i1).is_err()); } agent.disconnect().unwrap(); diff --git a/tests/all/knownhosts.rs b/tests/all/knownhosts.rs index 1847797..ab83577 100644 --- a/tests/all/knownhosts.rs +++ b/tests/all/knownhosts.rs @@ -3,8 +3,9 @@ use ssh2::{KnownHostFileKind, Session}; #[test] fn smoke() { let sess = Session::new().unwrap(); - let hosts = sess.known_hosts().unwrap(); - assert_eq!(hosts.iter().count(), 0); + let known_hosts = sess.known_hosts().unwrap(); + let hosts = known_hosts.hosts().unwrap(); + assert_eq!(hosts.len(), 0); } #[test] @@ -20,11 +21,14 @@ PW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\ /w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== "; let sess = Session::new().unwrap(); - let mut hosts = sess.known_hosts().unwrap(); - hosts.read_str(encoded, KnownHostFileKind::OpenSSH).unwrap(); + let mut known_hosts = sess.known_hosts().unwrap(); + known_hosts + .read_str(encoded, KnownHostFileKind::OpenSSH) + .unwrap(); - assert_eq!(hosts.iter().count(), 1); - let host = hosts.iter().next().unwrap().unwrap(); + let hosts = known_hosts.hosts().unwrap(); + assert_eq!(hosts.len(), 1); + let host = &hosts[0]; assert_eq!(host.name(), None); assert_eq!( host.key(), @@ -39,10 +43,10 @@ PW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\ ); assert_eq!( - hosts - .write_string(&host, KnownHostFileKind::OpenSSH) + known_hosts + .write_string(host, KnownHostFileKind::OpenSSH) .unwrap(), encoded ); - hosts.remove(host).unwrap(); + known_hosts.remove(host).unwrap(); } diff --git a/tests/all/main.rs b/tests/all/main.rs index f74684a..87380eb 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -36,7 +36,8 @@ pub fn authed_session() -> ssh2::Session { let mut agent = sess.agent().unwrap(); agent.connect().unwrap(); agent.list_identities().unwrap(); - let identity = agent.identities().next().unwrap().unwrap(); + let identities = agent.identities().unwrap(); + let identity = &identities[0]; agent.userauth(&user, &identity).unwrap(); } assert!(sess.authenticated()); diff --git a/tests/all/session.rs b/tests/all/session.rs index 8894081..ee3eaa0 100644 --- a/tests/all/session.rs +++ b/tests/all/session.rs @@ -51,7 +51,7 @@ fn smoke_handshake() { agent.connect().unwrap(); agent.list_identities().unwrap(); { - let identity = agent.identities().next().unwrap().unwrap(); + let identity = &agent.identities().unwrap()[0]; agent.userauth(&user, &identity).unwrap(); } assert!(sess.authenticated()); |