abiquo-installer-tests 20120104 → 20121023.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -7
- data/bin/abiquo-installer-tests +68 -43
- data/tests/1.8.5/abiquo_ciab.rb +21 -0
- data/tests/1.8.5/abiquo_kvm.rb +25 -0
- data/tests/1.8.5/abiquo_lvmiscsi.rb +17 -0
- data/tests/1.8.5/abiquo_monolithic.rb +12 -0
- data/tests/1.8.5/abiquo_nfs_repository.rb +23 -0
- data/tests/1.8.5/abiquo_platform.rb +39 -0
- data/tests/1.8.5/abiquo_remote_services.rb +115 -0
- data/tests/1.8.5/abiquo_server.rb +63 -0
- data/tests/1.8.5/abiquo_v2v.rb +37 -0
- data/tests/1.8.5/abiquo_vbox.rb +27 -0
- data/tests/1.8.5/abiquo_xen.rb +27 -0
- data/tests/2.0/abiquo_ciab.rb +9 -0
- data/tests/2.0/abiquo_community_hypervisor.rb +52 -0
- data/tests/2.0/abiquo_kvm.rb +5 -23
- data/tests/2.0/abiquo_monolithic.rb +12 -1
- data/tests/2.0/abiquo_platform.rb +2 -2
- data/tests/2.0/abiquo_remote_services.rb +15 -38
- data/tests/2.0/abiquo_server.rb +7 -1
- data/tests/2.0/abiquo_v2v.rb +42 -0
- data/tests/2.0/abiquo_vbox.rb +5 -25
- data/tests/2.0/abiquo_xen.rb +5 -25
- data/tests/2.2.0/abiquo_ciab.rb +30 -0
- data/tests/2.2.0/abiquo_community_hypervisor.rb +52 -0
- data/tests/2.2.0/abiquo_kvm.rb +7 -0
- data/tests/2.2.0/abiquo_lvmiscsi.rb +17 -0
- data/tests/2.2.0/abiquo_monolithic.rb +23 -0
- data/tests/2.2.0/abiquo_nfs_repository.rb +23 -0
- data/tests/2.2.0/abiquo_platform.rb +35 -0
- data/tests/2.2.0/abiquo_remote_services.rb +96 -0
- data/tests/2.2.0/abiquo_server.rb +95 -0
- data/tests/2.2.0/abiquo_v2v.rb +79 -0
- data/tests/2.2.0/abiquo_vbox.rb +7 -0
- data/tests/2.2.0/abiquo_xen.rb +7 -0
- data/tests/2.3.0/abiquo_ciab.rb +30 -0
- data/tests/2.3.0/abiquo_community_hypervisor.rb +52 -0
- data/tests/2.3.0/abiquo_kvm.rb +7 -0
- data/tests/2.3.0/abiquo_lvmiscsi.rb +17 -0
- data/tests/2.3.0/abiquo_monolithic.rb +23 -0
- data/tests/2.3.0/abiquo_nfs_repository.rb +23 -0
- data/tests/2.3.0/abiquo_platform.rb +35 -0
- data/tests/2.3.0/abiquo_remote_services.rb +96 -0
- data/tests/2.3.0/abiquo_server.rb +95 -0
- data/tests/2.3.0/abiquo_v2v.rb +79 -0
- data/tests/2.3.0/abiquo_vbox.rb +7 -0
- data/tests/2.3.0/abiquo_xen.rb +7 -0
- data/tests/abiquo_postinst_test.rb +12 -1
- data/vendor/net-scp-1.0.4/CHANGELOG.rdoc +29 -0
- data/vendor/net-scp-1.0.4/Manifest +17 -0
- data/vendor/net-scp-1.0.4/README.rdoc +98 -0
- data/vendor/net-scp-1.0.4/Rakefile +83 -0
- data/vendor/net-scp-1.0.4/lib/net/scp.rb +432 -0
- data/vendor/net-scp-1.0.4/lib/net/scp/download.rb +150 -0
- data/vendor/net-scp-1.0.4/lib/net/scp/errors.rb +5 -0
- data/vendor/net-scp-1.0.4/lib/net/scp/upload.rb +142 -0
- data/vendor/net-scp-1.0.4/lib/net/scp/version.rb +18 -0
- data/vendor/net-scp-1.0.4/lib/uri/open-scp.rb +18 -0
- data/vendor/net-scp-1.0.4/lib/uri/scp.rb +35 -0
- data/vendor/net-scp-1.0.4/net-scp.gemspec +34 -0
- data/vendor/net-scp-1.0.4/setup.rb +1331 -0
- data/vendor/net-scp-1.0.4/test/common.rb +153 -0
- data/vendor/net-scp-1.0.4/test/test_all.rb +3 -0
- data/vendor/net-scp-1.0.4/test/test_download.rb +170 -0
- data/vendor/net-scp-1.0.4/test/test_scp.rb +60 -0
- data/vendor/net-scp-1.0.4/test/test_upload.rb +269 -0
- data/vendor/net-sftp-2.0.5/CHANGELOG.rdoc +49 -0
- data/vendor/net-sftp-2.0.5/Manifest +55 -0
- data/vendor/net-sftp-2.0.5/README.rdoc +96 -0
- data/vendor/net-sftp-2.0.5/Rakefile +30 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp.rb +70 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/constants.rb +187 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/errors.rb +39 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/dir.rb +93 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/download.rb +364 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file.rb +176 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file_factory.rb +60 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/upload.rb +387 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/packet.rb +21 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol.rb +32 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/attributes.rb +315 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/base.rb +268 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/name.rb +43 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/02/base.rb +31 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/03/base.rb +35 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/attributes.rb +152 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/base.rb +94 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/name.rb +67 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/05/base.rb +66 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/attributes.rb +107 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/base.rb +63 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/base.rb +50 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/request.rb +91 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/response.rb +76 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/session.rb +952 -0
- data/vendor/net-sftp-2.0.5/lib/net/sftp/version.rb +18 -0
- data/vendor/net-sftp-2.0.5/net-sftp.gemspec +34 -0
- data/vendor/net-sftp-2.0.5/setup.rb +1331 -0
- data/vendor/net-sftp-2.0.5/test/common.rb +172 -0
- data/vendor/net-sftp-2.0.5/test/protocol/01/test_attributes.rb +97 -0
- data/vendor/net-sftp-2.0.5/test/protocol/01/test_base.rb +210 -0
- data/vendor/net-sftp-2.0.5/test/protocol/01/test_name.rb +27 -0
- data/vendor/net-sftp-2.0.5/test/protocol/02/test_base.rb +26 -0
- data/vendor/net-sftp-2.0.5/test/protocol/03/test_base.rb +27 -0
- data/vendor/net-sftp-2.0.5/test/protocol/04/test_attributes.rb +148 -0
- data/vendor/net-sftp-2.0.5/test/protocol/04/test_base.rb +74 -0
- data/vendor/net-sftp-2.0.5/test/protocol/04/test_name.rb +53 -0
- data/vendor/net-sftp-2.0.5/test/protocol/05/test_base.rb +62 -0
- data/vendor/net-sftp-2.0.5/test/protocol/06/test_attributes.rb +124 -0
- data/vendor/net-sftp-2.0.5/test/protocol/06/test_base.rb +51 -0
- data/vendor/net-sftp-2.0.5/test/protocol/test_base.rb +42 -0
- data/vendor/net-sftp-2.0.5/test/test_all.rb +7 -0
- data/vendor/net-sftp-2.0.5/test/test_dir.rb +47 -0
- data/vendor/net-sftp-2.0.5/test/test_download.rb +252 -0
- data/vendor/net-sftp-2.0.5/test/test_file.rb +159 -0
- data/vendor/net-sftp-2.0.5/test/test_file_factory.rb +48 -0
- data/vendor/net-sftp-2.0.5/test/test_packet.rb +9 -0
- data/vendor/net-sftp-2.0.5/test/test_protocol.rb +17 -0
- data/vendor/net-sftp-2.0.5/test/test_request.rb +71 -0
- data/vendor/net-sftp-2.0.5/test/test_response.rb +53 -0
- data/vendor/net-sftp-2.0.5/test/test_session.rb +741 -0
- data/vendor/net-sftp-2.0.5/test/test_upload.rb +219 -0
- data/vendor/net-ssh-2.5.2/CHANGELOG.rdoc +295 -0
- data/vendor/net-ssh-2.5.2/LICENSE.rdoc +19 -0
- data/vendor/net-ssh-2.5.2/Manifest +132 -0
- data/vendor/net-ssh-2.5.2/README.rdoc +184 -0
- data/vendor/net-ssh-2.5.2/Rakefile +88 -0
- data/vendor/net-ssh-2.5.2/Rudyfile +96 -0
- data/vendor/net-ssh-2.5.2/THANKS.rdoc +19 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh.rb +223 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent.rb +23 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/java_pageant.rb +85 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/socket.rb +170 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/constants.rb +18 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/key_manager.rb +253 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/abstract.rb +60 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/hostbased.rb +75 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/keyboard_interactive.rb +70 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/password.rb +43 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/publickey.rb +96 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/pageant.rb +264 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/session.rb +154 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/buffer.rb +350 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/buffered_io.rb +198 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/config.rb +207 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/channel.rb +630 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/constants.rb +33 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/session.rb +597 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/term.rb +178 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/errors.rb +88 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/key_factory.rb +107 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/known_hosts.rb +141 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/loggable.rb +61 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/packet.rb +102 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/prompt.rb +93 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/command.rb +75 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/errors.rb +14 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/http.rb +94 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks4.rb +70 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks5.rb +142 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb +51 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/service/forward.rb +298 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test.rb +89 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/channel.rb +129 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/extensions.rb +152 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/kex.rb +44 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/local_packet.rb +51 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/packet.rb +81 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/remote_packet.rb +38 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/script.rb +157 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/test/socket.rb +64 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/algorithms.rb +407 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/cipher_factory.rb +106 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/constants.rb +32 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/ctr.rb +95 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac.rb +45 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/abstract.rb +79 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5.rb +12 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/none.rb +15 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/ripemd160.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256.rb +15 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256_96.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512.rb +14 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512_96.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/identity_cipher.rb +55 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex.rb +28 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +44 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +216 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +80 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +15 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +93 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +13 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/key_expander.rb +26 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/openssl.rb +237 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/packet_stream.rb +235 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/server_version.rb +71 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/session.rb +278 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/state.rb +206 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/lenient.rb +30 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/null.rb +12 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/strict.rb +53 -0
- data/vendor/net-ssh-2.5.2/lib/net/ssh/version.rb +62 -0
- data/vendor/net-ssh-2.5.2/net-ssh.gemspec +172 -0
- data/vendor/net-ssh-2.5.2/setup.rb +1585 -0
- data/vendor/net-ssh-2.5.2/support/arcfour_check.rb +20 -0
- data/vendor/net-ssh-2.5.2/support/ssh_tunnel_bug.rb +65 -0
- data/vendor/net-ssh-2.5.2/test/README.txt +43 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/common.rb +28 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/test_abstract.rb +51 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/test_hostbased.rb +114 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/test_keyboard_interactive.rb +100 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/test_password.rb +52 -0
- data/vendor/net-ssh-2.5.2/test/authentication/methods/test_publickey.rb +148 -0
- data/vendor/net-ssh-2.5.2/test/authentication/test_agent.rb +205 -0
- data/vendor/net-ssh-2.5.2/test/authentication/test_key_manager.rb +218 -0
- data/vendor/net-ssh-2.5.2/test/authentication/test_session.rb +106 -0
- data/vendor/net-ssh-2.5.2/test/common.rb +107 -0
- data/vendor/net-ssh-2.5.2/test/configs/eqsign +3 -0
- data/vendor/net-ssh-2.5.2/test/configs/exact_match +8 -0
- data/vendor/net-ssh-2.5.2/test/configs/host_plus +10 -0
- data/vendor/net-ssh-2.5.2/test/configs/multihost +4 -0
- data/vendor/net-ssh-2.5.2/test/configs/nohost +19 -0
- data/vendor/net-ssh-2.5.2/test/configs/numeric_host +4 -0
- data/vendor/net-ssh-2.5.2/test/configs/wild_cards +14 -0
- data/vendor/net-ssh-2.5.2/test/connection/test_channel.rb +467 -0
- data/vendor/net-ssh-2.5.2/test/connection/test_session.rb +488 -0
- data/vendor/net-ssh-2.5.2/test/known_hosts/github +1 -0
- data/vendor/net-ssh-2.5.2/test/manual/test_forward.rb +223 -0
- data/vendor/net-ssh-2.5.2/test/start/test_transport.rb +28 -0
- data/vendor/net-ssh-2.5.2/test/test_all.rb +9 -0
- data/vendor/net-ssh-2.5.2/test/test_buffer.rb +426 -0
- data/vendor/net-ssh-2.5.2/test/test_buffered_io.rb +63 -0
- data/vendor/net-ssh-2.5.2/test/test_config.rb +120 -0
- data/vendor/net-ssh-2.5.2/test/test_key_factory.rb +121 -0
- data/vendor/net-ssh-2.5.2/test/test_known_hosts.rb +13 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5.rb +39 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5_96.rb +25 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_none.rb +34 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_ripemd160.rb +34 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1.rb +34 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1_96.rb +25 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256.rb +35 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256_96.rb +25 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512.rb +35 -0
- data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512_96.rb +25 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group14_sha1.rb +13 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +33 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp256.rb +161 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp384.rb +37 -0
- data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp521.rb +37 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_algorithms.rb +330 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_cipher_factory.rb +441 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_hmac.rb +34 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_identity_cipher.rb +40 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_packet_stream.rb +1745 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_server_version.rb +78 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_session.rb +315 -0
- data/vendor/net-ssh-2.5.2/test/transport/test_state.rb +179 -0
- metadata +325 -78
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/buffered_io'
|
3
|
+
|
4
|
+
class TestBufferedIo < Test::Unit::TestCase
|
5
|
+
def test_fill_should_pull_from_underlying_io
|
6
|
+
io.expects(:recv).with(8192).returns("here is some data")
|
7
|
+
assert_equal 17, io.fill
|
8
|
+
assert_equal 17, io.available
|
9
|
+
assert_equal "here is some data", io.read_available(20)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_enqueue_should_not_write_to_underlying_io
|
13
|
+
assert !io.pending_write?
|
14
|
+
io.expects(:send).never
|
15
|
+
io.enqueue("here is some data")
|
16
|
+
assert io.pending_write?
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_send_pending_should_not_fail_when_no_writes_are_pending
|
20
|
+
assert !io.pending_write?
|
21
|
+
io.expects(:send).never
|
22
|
+
assert_nothing_raised { io.send_pending }
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_send_pending_with_pending_writes_should_write_to_underlying_io
|
26
|
+
io.enqueue("here is some data")
|
27
|
+
io.expects(:send).with("here is some data", 0).returns(17)
|
28
|
+
assert io.pending_write?
|
29
|
+
assert_nothing_raised { io.send_pending }
|
30
|
+
assert !io.pending_write?
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_wait_for_pending_sends_should_write_only_once_if_all_can_be_written_at_once
|
34
|
+
io.enqueue("here is some data")
|
35
|
+
io.expects(:send).with("here is some data", 0).returns(17)
|
36
|
+
assert io.pending_write?
|
37
|
+
assert_nothing_raised { io.wait_for_pending_sends }
|
38
|
+
assert !io.pending_write?
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_wait_for_pending_sends_should_write_multiple_times_if_first_write_was_partial
|
42
|
+
io.enqueue("here is some data")
|
43
|
+
|
44
|
+
io.expects(:send).with("here is some data", 0).returns(10)
|
45
|
+
io.expects(:send).with("me data", 0).returns(4)
|
46
|
+
io.expects(:send).with("ata", 0).returns(3)
|
47
|
+
|
48
|
+
IO.expects(:select).times(2).with(nil, [io]).returns([[], [io]])
|
49
|
+
|
50
|
+
assert_nothing_raised { io.wait_for_pending_sends }
|
51
|
+
assert !io.pending_write?
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def io
|
57
|
+
@io ||= begin
|
58
|
+
io = mock("io")
|
59
|
+
io.extend(Net::SSH::BufferedIo)
|
60
|
+
io
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/config'
|
3
|
+
|
4
|
+
class TestConfig < Test::Unit::TestCase
|
5
|
+
def test_load_for_non_existant_file_should_return_empty_hash
|
6
|
+
bogus_file = File.expand_path("/bogus/file")
|
7
|
+
File.expects(:readable?).with(bogus_file).returns(false)
|
8
|
+
assert_equal({}, Net::SSH::Config.load(bogus_file, "host.name"))
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_load_should_expand_path
|
12
|
+
expected = File.expand_path("~/.ssh/config")
|
13
|
+
File.expects(:readable?).with(expected).returns(false)
|
14
|
+
Net::SSH::Config.load("~/.ssh/config", "host.name")
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_load_with_exact_host_match_should_load_that_section
|
18
|
+
config = Net::SSH::Config.load(config(:exact_match), "test.host")
|
19
|
+
assert config['compression']
|
20
|
+
assert config['forwardagent']
|
21
|
+
assert_equal 1234, config['port']
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_load_with_wild_card_matches_should_load_all_matches_with_first_match_taking_precedence
|
25
|
+
config = Net::SSH::Config.load(config(:wild_cards), "test.host")
|
26
|
+
assert_equal 1234, config['port']
|
27
|
+
assert !config['compression']
|
28
|
+
assert config['forwardagent']
|
29
|
+
assert_equal %w(~/.ssh/id_dsa), config['identityfile']
|
30
|
+
assert !config.key?('rekeylimit')
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_for_should_load_all_files_and_translate_to_net_ssh_options
|
34
|
+
config = Net::SSH::Config.for("test.host", [config(:exact_match), config(:wild_cards)])
|
35
|
+
assert_equal 1234, config[:port]
|
36
|
+
assert config[:compression]
|
37
|
+
assert config[:forward_agent]
|
38
|
+
assert_equal %w(~/.ssh/id_dsa), config[:keys]
|
39
|
+
assert !config.key?(:rekey_limit)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_load_with_no_host
|
43
|
+
config = Net::SSH::Config.load(config(:nohost), "test.host")
|
44
|
+
assert_equal %w(~/.ssh/id_dsa ~/.ssh/id_rsa), config['identityfile']
|
45
|
+
assert_equal 1985, config['port']
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_load_with_multiple_hosts
|
49
|
+
config = Net::SSH::Config.load(config(:multihost), "test.host")
|
50
|
+
assert config['compression']
|
51
|
+
assert_equal '2G', config['rekeylimit']
|
52
|
+
assert_equal 1980, config['port']
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_load_with_multiple_hosts_and_config_should_match_for_both
|
56
|
+
aconfig = Net::SSH::Config.load(config(:multihost), "test.host")
|
57
|
+
bconfig = Net::SSH::Config.load(config(:multihost), "other.host")
|
58
|
+
assert_equal aconfig['port'], bconfig['port']
|
59
|
+
assert_equal aconfig['compression'], bconfig['compression']
|
60
|
+
assert_equal aconfig['rekeylimit'], bconfig['rekeylimit']
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_load_should_parse_equal_sign_delimiters
|
64
|
+
config = Net::SSH::Config.load(config(:eqsign), "test.test")
|
65
|
+
assert config['compression']
|
66
|
+
assert_equal 1234, config['port']
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_translate_should_correctly_translate_from_openssh_to_net_ssh_names
|
70
|
+
open_ssh = {
|
71
|
+
'bindaddress' => "127.0.0.1",
|
72
|
+
'ciphers' => "a,b,c",
|
73
|
+
'compression' => true,
|
74
|
+
'compressionlevel' => 6,
|
75
|
+
'connecttimeout' => 100,
|
76
|
+
'forwardagent' => true,
|
77
|
+
'hostbasedauthentication' => true,
|
78
|
+
'hostkeyalgorithms' => "d,e,f",
|
79
|
+
'identityfile' => %w(g h i),
|
80
|
+
'macs' => "j,k,l",
|
81
|
+
'passwordauthentication' => true,
|
82
|
+
'port' => 1234,
|
83
|
+
'pubkeyauthentication' => true,
|
84
|
+
'rekeylimit' => 1024
|
85
|
+
}
|
86
|
+
|
87
|
+
net_ssh = Net::SSH::Config.translate(open_ssh)
|
88
|
+
|
89
|
+
assert_equal %w(a b c), net_ssh[:encryption]
|
90
|
+
assert_equal true, net_ssh[:compression]
|
91
|
+
assert_equal 6, net_ssh[:compression_level]
|
92
|
+
assert_equal 100, net_ssh[:timeout]
|
93
|
+
assert_equal true, net_ssh[:forward_agent]
|
94
|
+
assert_equal %w(hostbased password publickey), net_ssh[:auth_methods].sort
|
95
|
+
assert_equal %w(d e f), net_ssh[:host_key]
|
96
|
+
assert_equal %w(g h i), net_ssh[:keys]
|
97
|
+
assert_equal %w(j k l), net_ssh[:hmac]
|
98
|
+
assert_equal 1234, net_ssh[:port]
|
99
|
+
assert_equal 1024, net_ssh[:rekey_limit]
|
100
|
+
assert_equal "127.0.0.1", net_ssh[:bind_address]
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_load_with_plus_sign_hosts
|
104
|
+
config = Net::SSH::Config.load(config(:host_plus), "test.host")
|
105
|
+
assert config['compression']
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_load_with_numeric_host
|
109
|
+
config = Net::SSH::Config.load(config(:numeric_host), "1234")
|
110
|
+
assert config['compression']
|
111
|
+
assert_equal '2G', config['rekeylimit']
|
112
|
+
assert_equal 1980, config['port']
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def config(name)
|
118
|
+
"test/configs/#{name}"
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/key_factory'
|
3
|
+
|
4
|
+
class TestKeyFactory < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@key_file = File.expand_path("/key-file")
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_load_unencrypted_private_RSA_key_should_return_key
|
10
|
+
File.expects(:read).with(@key_file).returns(rsa_key.export)
|
11
|
+
assert_equal rsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file).to_der
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_load_unencrypted_private_DSA_key_should_return_key
|
15
|
+
File.expects(:read).with(@key_file).returns(dsa_key.export)
|
16
|
+
assert_equal dsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file).to_der
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_load_encrypted_private_RSA_key_should_prompt_for_password_and_return_key
|
20
|
+
File.expects(:read).with(@key_file).returns(encrypted(rsa_key, "password"))
|
21
|
+
Net::SSH::KeyFactory.expects(:prompt).with("Enter passphrase for #{@key_file}:", false).returns("password")
|
22
|
+
assert_equal rsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file).to_der
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_load_encrypted_private_RSA_key_with_password_should_not_prompt_and_return_key
|
26
|
+
File.expects(:read).with(@key_file).returns(encrypted(rsa_key, "password"))
|
27
|
+
assert_equal rsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file, "password").to_der
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_load_encrypted_private_DSA_key_should_prompt_for_password_and_return_key
|
31
|
+
File.expects(:read).with(@key_file).returns(encrypted(dsa_key, "password"))
|
32
|
+
Net::SSH::KeyFactory.expects(:prompt).with("Enter passphrase for #{@key_file}:", false).returns("password")
|
33
|
+
assert_equal dsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file).to_der
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_load_encrypted_private_DSA_key_with_password_should_not_prompt_and_return_key
|
37
|
+
File.expects(:read).with(@key_file).returns(encrypted(dsa_key, "password"))
|
38
|
+
assert_equal dsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file, "password").to_der
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_load_encrypted_private_key_should_give_three_tries_for_the_password_and_then_raise_exception
|
42
|
+
File.expects(:read).with(@key_file).returns(encrypted(rsa_key, "password"))
|
43
|
+
Net::SSH::KeyFactory.expects(:prompt).times(3).with("Enter passphrase for #{@key_file}:", false).returns("passwod","passphrase","passwd")
|
44
|
+
assert_raises(OpenSSL::PKey::RSAError) { Net::SSH::KeyFactory.load_private_key(@key_file) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_load_encrypted_private_key_should_raise_exception_without_asking_passphrase
|
48
|
+
File.expects(:read).with(@key_file).returns(encrypted(rsa_key, "password"))
|
49
|
+
Net::SSH::KeyFactory.expects(:prompt).never
|
50
|
+
assert_raises(OpenSSL::PKey::RSAError) { Net::SSH::KeyFactory.load_private_key(@key_file, nil, false) }
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_load_public_rsa_key_should_return_key
|
54
|
+
File.expects(:read).with(@key_file).returns(public(rsa_key))
|
55
|
+
assert_equal rsa_key.to_blob, Net::SSH::KeyFactory.load_public_key(@key_file).to_blob
|
56
|
+
end
|
57
|
+
|
58
|
+
if defined?(OpenSSL::PKey::EC)
|
59
|
+
def test_load_unencrypted_private_ecdsa_sha2_nistp256_key_should_return_key
|
60
|
+
File.expects(:read).with("/key-file").returns(ecdsa_sha2_nistp256_key.to_pem)
|
61
|
+
assert_equal ecdsa_sha2_nistp256_key.to_der, Net::SSH::KeyFactory.load_private_key("/key-file").to_der
|
62
|
+
end
|
63
|
+
def test_load_unencrypted_private_ecdsa_sha2_nistp384_key_should_return_key
|
64
|
+
File.expects(:read).with("/key-file").returns(ecdsa_sha2_nistp384_key.to_pem)
|
65
|
+
assert_equal ecdsa_sha2_nistp384_key.to_der, Net::SSH::KeyFactory.load_private_key("/key-file").to_der
|
66
|
+
end
|
67
|
+
def test_load_unencrypted_private_ecdsa_sha2_nistp521_key_should_return_key
|
68
|
+
File.expects(:read).with("/key-file").returns(ecdsa_sha2_nistp521_key.to_pem)
|
69
|
+
assert_equal ecdsa_sha2_nistp521_key.to_der, Net::SSH::KeyFactory.load_private_key("/key-file").to_der
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_load_public_ecdsa_sha2_nistp256_key_should_return_key
|
73
|
+
File.expects(:read).with("/key-file").returns(public(ecdsa_sha2_nistp256_key))
|
74
|
+
assert_equal ecdsa_sha2_nistp256_key.to_blob, Net::SSH::KeyFactory.load_public_key("/key-file").to_blob
|
75
|
+
end
|
76
|
+
def test_load_public_ecdsa_sha2_nistp384_key_should_return_key
|
77
|
+
File.expects(:read).with("/key-file").returns(public(ecdsa_sha2_nistp384_key))
|
78
|
+
assert_equal ecdsa_sha2_nistp384_key.to_blob, Net::SSH::KeyFactory.load_public_key("/key-file").to_blob
|
79
|
+
end
|
80
|
+
def test_load_public_ecdsa_sha2_nistp521_key_should_return_key
|
81
|
+
File.expects(:read).with("/key-file").returns(public(ecdsa_sha2_nistp521_key))
|
82
|
+
assert_equal ecdsa_sha2_nistp521_key.to_blob, Net::SSH::KeyFactory.load_public_key("/key-file").to_blob
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def rsa_key
|
89
|
+
# 512 bits
|
90
|
+
@rsa_key ||= OpenSSL::PKey::RSA.new("0\202\001;\002\001\000\002A\000\235\236\374N\e@2E\321\3757\003\354c\276N\f\003\3479Ko\005\317\0027\a\255=\345!\306\220\340\211;\027u\331\260\362\2063x\332\301y4\353\v%\032\214v\312\304\212\271GJ\353\2701\031\002\003\001\000\001\002@\022Y\306*\031\306\031\224Cde\231QV3{\306\256U\2477\377\017\000\020\323\363R\332\027\351\034\224OU\020\227H|pUS\n\263+%\304\341\321\273/\271\e\004L\250\273\020&,\t\304By\002!\000\311c\246%a\002\305\277\262R\266\244\250\025V_\351]\264\016\265\341\355\305\223\347Z$8\205#\023\002!\000\310\\\367|\243I\363\350\020\307\246\302\365\ed\212L\273\2158M\223w\a\367 C\t\224A4\243\002!\000\262]+}\327\231\331\002\2331^\312\036\204'g\363\f&\271\020\245\365-\024}\306\374e\202\2459\002 }\231\341\276\3551\277\307{5\\\361\233\353G\024wS\237\fk}\004\302&\205\277\340rb\211\327\002!\000\223\307\025I:\215_\260\370\252\3757\256Y&X\364\354\342\215\350\203E8\227|\f\237M\375D|")
|
91
|
+
end
|
92
|
+
|
93
|
+
def dsa_key
|
94
|
+
# 512 bits
|
95
|
+
@dsa_key ||= OpenSSL::PKey::DSA.new("0\201\367\002\001\000\002A\000\203\316/\037u\272&J\265\003l3\315d\324h\372{\t8\252#\331_\026\006\035\270\266\255\343\353Z\302\276\335\336\306\220\375\202L\244\244J\206>\346\b\315\211\302L\246x\247u\a\376\366\345\302\016#\002\025\000\244\274\302\221Og\275/\302+\356\346\360\024\373wI\2573\361\002@\027\215\270r*\f\213\350C\245\021:\350 \006\\\376\345\022`\210b\262\3643\023XLKS\320\370\002\276\347A\nU\204\276\324\256`=\026\240\330\306J\316V\213\024\e\030\215\355\006\037q\337\356ln\002@\017\257\034\f\260\333'S\271#\237\230E\321\312\027\021\226\331\251Vj\220\305\316\036\v\266+\000\230\270\177B\003?t\a\305]e\344\261\334\023\253\323\251\223M\2175)a(\004\"lI8\312\303\307\a\002\024_\aznW\345\343\203V\326\246ua\203\376\201o\350\302\002")
|
96
|
+
end
|
97
|
+
|
98
|
+
if defined?(OpenSSL::PKey::EC)
|
99
|
+
def ecdsa_sha2_nistp256_key
|
100
|
+
@ecdsa_sha2_nistp256_key ||= OpenSSL::PKey::EC.new("-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEINv6pPVLlkqvT1v5MJlWgaSWGwqupISG4U79bUXQDNCaoAoGCCqGSM49\nAwEHoUQDQgAElqubvi/GkSme+bwtncU1NiE0dWQ0EO07VufUQg8lUJ5+Fi6f96qa\n95T1zwOMQhY1h8PP9rQIZr4S48vN/ZnQLw==\n-----END EC PRIVATE KEY-----\n")
|
101
|
+
end
|
102
|
+
|
103
|
+
def ecdsa_sha2_nistp384_key
|
104
|
+
@ecdsa_sha2_nistp384_key ||= OpenSSL::PKey::EC.new("-----BEGIN EC PRIVATE KEY-----\nMIGkAgEBBDBxwkmydCn4mP4KMhlMpeBvIroQolWKVNoRPXpG7brFgK+Yiikqw8wd\nIZW5OlL4y3mgBwYFK4EEACKhZANiAARkoIR1oABi+aQJbKcmvzeYSKURQOyXM0HU\nR4T68v4hd/lJE4fFQRczj3wAaECe9u3CWI/oDlow4Vr0vab82ZGjIoblxblKQWYl\nyzENgzl226waGg1bLBo8Auilyf1B5yI=\n-----END EC PRIVATE KEY-----\n")
|
105
|
+
end
|
106
|
+
|
107
|
+
def ecdsa_sha2_nistp521_key
|
108
|
+
@ecdsa_sha2_nistp521_key ||= OpenSSL::PKey::EC.new("-----BEGIN EC PRIVATE KEY-----\nMIHbAgEBBEHQ2i7kjEGQHQB4pUQW9a2eCLWR2S5Go8U3CDyfbRCrYEp/pTSgI8uu\nMXyR3bf3SjqFQgZ6MZk5lkyrissJuwmvZKAHBgUrgQQAI6GBiQOBhgAEAN14FACK\nbs/KTqw4rxijeozGTVJTh1hNzBl2XaIhM4Fv8o3fE/pvogymyFu53GCng6gC4dmx\n/hycF41iIM29xVKPAeBnRNl6MdFBjuthOmE8eCRezgk1Bak8aBDUrzNT8OQssscw\npvQK4nc6ga/wTDaQGy5kV8tCOHNs2wKH+p2LpWTJ\n-----END EC PRIVATE KEY-----\n")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def encrypted(key, password)
|
113
|
+
key.export(OpenSSL::Cipher::Cipher.new("des-ede3-cbc"), password)
|
114
|
+
end
|
115
|
+
|
116
|
+
def public(key)
|
117
|
+
result = "#{key.ssh_type} "
|
118
|
+
result << [Net::SSH::Buffer.from(:key, key).to_s].pack("m*").strip.tr("\n\r\t ", "")
|
119
|
+
result << " joe@host.test"
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'common'
|
2
|
+
|
3
|
+
class TestKnownHosts < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_key_for_when_all_hosts_are_recognized
|
6
|
+
source = File.join(File.dirname(__FILE__),"known_hosts/github")
|
7
|
+
kh = Net::SSH::KnownHosts.new(source)
|
8
|
+
keys = kh.keys_for("github.com")
|
9
|
+
assert_equal(1, keys.count)
|
10
|
+
assert_equal("ssh-rsa", keys[0].ssh_type)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/transport/hmac/md5'
|
3
|
+
|
4
|
+
module Transport; module HMAC
|
5
|
+
|
6
|
+
class TestMD5 < Test::Unit::TestCase
|
7
|
+
def test_expected_digest_class
|
8
|
+
assert_equal OpenSSL::Digest::MD5, subject.digest_class
|
9
|
+
assert_equal OpenSSL::Digest::MD5, subject.new.digest_class
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_expected_key_length
|
13
|
+
assert_equal 16, subject.key_length
|
14
|
+
assert_equal 16, subject.new.key_length
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_expected_mac_length
|
18
|
+
assert_equal 16, subject.mac_length
|
19
|
+
assert_equal 16, subject.new.mac_length
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_expected_digest
|
23
|
+
hmac = subject.new("1234567890123456")
|
24
|
+
assert_equal "\275\345\006\307y~Oi\035<.\341\031\250<\257", hmac.digest("hello world")
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_key_should_be_truncated_to_required_length
|
28
|
+
hmac = subject.new("12345678901234567890")
|
29
|
+
assert_equal "1234567890123456", hmac.key
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def subject
|
35
|
+
Net::SSH::Transport::HMAC::MD5
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end; end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'transport/hmac/test_md5'
|
3
|
+
require 'net/ssh/transport/hmac/md5_96'
|
4
|
+
|
5
|
+
module Transport; module HMAC
|
6
|
+
|
7
|
+
class TestMD5_96 < TestMD5
|
8
|
+
def test_expected_mac_length
|
9
|
+
assert_equal 12, subject.mac_length
|
10
|
+
assert_equal 12, subject.new.mac_length
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_expected_digest
|
14
|
+
hmac = subject.new("1234567890123456")
|
15
|
+
assert_equal "\275\345\006\307y~Oi\035<.\341", hmac.digest("hello world")
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def subject
|
21
|
+
Net::SSH::Transport::HMAC::MD5_96
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end; end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/transport/hmac/none'
|
3
|
+
|
4
|
+
module Transport; module HMAC
|
5
|
+
|
6
|
+
class TestNone < Test::Unit::TestCase
|
7
|
+
def test_expected_digest_class
|
8
|
+
assert_equal nil, subject.digest_class
|
9
|
+
assert_equal nil, subject.new.digest_class
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_expected_key_length
|
13
|
+
assert_equal 0, subject.key_length
|
14
|
+
assert_equal 0, subject.new.key_length
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_expected_mac_length
|
18
|
+
assert_equal 0, subject.mac_length
|
19
|
+
assert_equal 0, subject.new.mac_length
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_expected_digest
|
23
|
+
hmac = subject.new("1234567890123456")
|
24
|
+
assert_equal "", hmac.digest("hello world")
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def subject
|
30
|
+
Net::SSH::Transport::HMAC::None
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end; end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'common'
|
2
|
+
require 'net/ssh/transport/hmac/ripemd160'
|
3
|
+
|
4
|
+
module Transport; module HMAC
|
5
|
+
|
6
|
+
class TestRipemd160 < Test::Unit::TestCase
|
7
|
+
def test_expected_digest_class
|
8
|
+
assert_equal OpenSSL::Digest::RIPEMD160, subject.digest_class
|
9
|
+
assert_equal OpenSSL::Digest::RIPEMD160, subject.new.digest_class
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_expected_key_length
|
13
|
+
assert_equal 20, subject.key_length
|
14
|
+
assert_equal 20, subject.new.key_length
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_expected_mac_length
|
18
|
+
assert_equal 20, subject.mac_length
|
19
|
+
assert_equal 20, subject.new.mac_length
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_expected_digest
|
23
|
+
hmac = subject.new("1234567890123456")
|
24
|
+
assert_equal "\xE4\x10\t\xB3\xD8,\x14\xA0k\x10\xB5\x0F?\x0E\x96q\x02\x16;E", hmac.digest("hello world")
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def subject
|
30
|
+
Net::SSH::Transport::HMAC::RIPEMD160
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end; end
|