abiquo-installer-tests 20120104 → 20121023.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. data/Rakefile +11 -7
  2. data/bin/abiquo-installer-tests +68 -43
  3. data/tests/1.8.5/abiquo_ciab.rb +21 -0
  4. data/tests/1.8.5/abiquo_kvm.rb +25 -0
  5. data/tests/1.8.5/abiquo_lvmiscsi.rb +17 -0
  6. data/tests/1.8.5/abiquo_monolithic.rb +12 -0
  7. data/tests/1.8.5/abiquo_nfs_repository.rb +23 -0
  8. data/tests/1.8.5/abiquo_platform.rb +39 -0
  9. data/tests/1.8.5/abiquo_remote_services.rb +115 -0
  10. data/tests/1.8.5/abiquo_server.rb +63 -0
  11. data/tests/1.8.5/abiquo_v2v.rb +37 -0
  12. data/tests/1.8.5/abiquo_vbox.rb +27 -0
  13. data/tests/1.8.5/abiquo_xen.rb +27 -0
  14. data/tests/2.0/abiquo_ciab.rb +9 -0
  15. data/tests/2.0/abiquo_community_hypervisor.rb +52 -0
  16. data/tests/2.0/abiquo_kvm.rb +5 -23
  17. data/tests/2.0/abiquo_monolithic.rb +12 -1
  18. data/tests/2.0/abiquo_platform.rb +2 -2
  19. data/tests/2.0/abiquo_remote_services.rb +15 -38
  20. data/tests/2.0/abiquo_server.rb +7 -1
  21. data/tests/2.0/abiquo_v2v.rb +42 -0
  22. data/tests/2.0/abiquo_vbox.rb +5 -25
  23. data/tests/2.0/abiquo_xen.rb +5 -25
  24. data/tests/2.2.0/abiquo_ciab.rb +30 -0
  25. data/tests/2.2.0/abiquo_community_hypervisor.rb +52 -0
  26. data/tests/2.2.0/abiquo_kvm.rb +7 -0
  27. data/tests/2.2.0/abiquo_lvmiscsi.rb +17 -0
  28. data/tests/2.2.0/abiquo_monolithic.rb +23 -0
  29. data/tests/2.2.0/abiquo_nfs_repository.rb +23 -0
  30. data/tests/2.2.0/abiquo_platform.rb +35 -0
  31. data/tests/2.2.0/abiquo_remote_services.rb +96 -0
  32. data/tests/2.2.0/abiquo_server.rb +95 -0
  33. data/tests/2.2.0/abiquo_v2v.rb +79 -0
  34. data/tests/2.2.0/abiquo_vbox.rb +7 -0
  35. data/tests/2.2.0/abiquo_xen.rb +7 -0
  36. data/tests/2.3.0/abiquo_ciab.rb +30 -0
  37. data/tests/2.3.0/abiquo_community_hypervisor.rb +52 -0
  38. data/tests/2.3.0/abiquo_kvm.rb +7 -0
  39. data/tests/2.3.0/abiquo_lvmiscsi.rb +17 -0
  40. data/tests/2.3.0/abiquo_monolithic.rb +23 -0
  41. data/tests/2.3.0/abiquo_nfs_repository.rb +23 -0
  42. data/tests/2.3.0/abiquo_platform.rb +35 -0
  43. data/tests/2.3.0/abiquo_remote_services.rb +96 -0
  44. data/tests/2.3.0/abiquo_server.rb +95 -0
  45. data/tests/2.3.0/abiquo_v2v.rb +79 -0
  46. data/tests/2.3.0/abiquo_vbox.rb +7 -0
  47. data/tests/2.3.0/abiquo_xen.rb +7 -0
  48. data/tests/abiquo_postinst_test.rb +12 -1
  49. data/vendor/net-scp-1.0.4/CHANGELOG.rdoc +29 -0
  50. data/vendor/net-scp-1.0.4/Manifest +17 -0
  51. data/vendor/net-scp-1.0.4/README.rdoc +98 -0
  52. data/vendor/net-scp-1.0.4/Rakefile +83 -0
  53. data/vendor/net-scp-1.0.4/lib/net/scp.rb +432 -0
  54. data/vendor/net-scp-1.0.4/lib/net/scp/download.rb +150 -0
  55. data/vendor/net-scp-1.0.4/lib/net/scp/errors.rb +5 -0
  56. data/vendor/net-scp-1.0.4/lib/net/scp/upload.rb +142 -0
  57. data/vendor/net-scp-1.0.4/lib/net/scp/version.rb +18 -0
  58. data/vendor/net-scp-1.0.4/lib/uri/open-scp.rb +18 -0
  59. data/vendor/net-scp-1.0.4/lib/uri/scp.rb +35 -0
  60. data/vendor/net-scp-1.0.4/net-scp.gemspec +34 -0
  61. data/vendor/net-scp-1.0.4/setup.rb +1331 -0
  62. data/vendor/net-scp-1.0.4/test/common.rb +153 -0
  63. data/vendor/net-scp-1.0.4/test/test_all.rb +3 -0
  64. data/vendor/net-scp-1.0.4/test/test_download.rb +170 -0
  65. data/vendor/net-scp-1.0.4/test/test_scp.rb +60 -0
  66. data/vendor/net-scp-1.0.4/test/test_upload.rb +269 -0
  67. data/vendor/net-sftp-2.0.5/CHANGELOG.rdoc +49 -0
  68. data/vendor/net-sftp-2.0.5/Manifest +55 -0
  69. data/vendor/net-sftp-2.0.5/README.rdoc +96 -0
  70. data/vendor/net-sftp-2.0.5/Rakefile +30 -0
  71. data/vendor/net-sftp-2.0.5/lib/net/sftp.rb +70 -0
  72. data/vendor/net-sftp-2.0.5/lib/net/sftp/constants.rb +187 -0
  73. data/vendor/net-sftp-2.0.5/lib/net/sftp/errors.rb +39 -0
  74. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/dir.rb +93 -0
  75. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/download.rb +364 -0
  76. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file.rb +176 -0
  77. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file_factory.rb +60 -0
  78. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/upload.rb +387 -0
  79. data/vendor/net-sftp-2.0.5/lib/net/sftp/packet.rb +21 -0
  80. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol.rb +32 -0
  81. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/attributes.rb +315 -0
  82. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/base.rb +268 -0
  83. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/name.rb +43 -0
  84. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/02/base.rb +31 -0
  85. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/03/base.rb +35 -0
  86. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/attributes.rb +152 -0
  87. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/base.rb +94 -0
  88. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/name.rb +67 -0
  89. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/05/base.rb +66 -0
  90. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/attributes.rb +107 -0
  91. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/base.rb +63 -0
  92. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/base.rb +50 -0
  93. data/vendor/net-sftp-2.0.5/lib/net/sftp/request.rb +91 -0
  94. data/vendor/net-sftp-2.0.5/lib/net/sftp/response.rb +76 -0
  95. data/vendor/net-sftp-2.0.5/lib/net/sftp/session.rb +952 -0
  96. data/vendor/net-sftp-2.0.5/lib/net/sftp/version.rb +18 -0
  97. data/vendor/net-sftp-2.0.5/net-sftp.gemspec +34 -0
  98. data/vendor/net-sftp-2.0.5/setup.rb +1331 -0
  99. data/vendor/net-sftp-2.0.5/test/common.rb +172 -0
  100. data/vendor/net-sftp-2.0.5/test/protocol/01/test_attributes.rb +97 -0
  101. data/vendor/net-sftp-2.0.5/test/protocol/01/test_base.rb +210 -0
  102. data/vendor/net-sftp-2.0.5/test/protocol/01/test_name.rb +27 -0
  103. data/vendor/net-sftp-2.0.5/test/protocol/02/test_base.rb +26 -0
  104. data/vendor/net-sftp-2.0.5/test/protocol/03/test_base.rb +27 -0
  105. data/vendor/net-sftp-2.0.5/test/protocol/04/test_attributes.rb +148 -0
  106. data/vendor/net-sftp-2.0.5/test/protocol/04/test_base.rb +74 -0
  107. data/vendor/net-sftp-2.0.5/test/protocol/04/test_name.rb +53 -0
  108. data/vendor/net-sftp-2.0.5/test/protocol/05/test_base.rb +62 -0
  109. data/vendor/net-sftp-2.0.5/test/protocol/06/test_attributes.rb +124 -0
  110. data/vendor/net-sftp-2.0.5/test/protocol/06/test_base.rb +51 -0
  111. data/vendor/net-sftp-2.0.5/test/protocol/test_base.rb +42 -0
  112. data/vendor/net-sftp-2.0.5/test/test_all.rb +7 -0
  113. data/vendor/net-sftp-2.0.5/test/test_dir.rb +47 -0
  114. data/vendor/net-sftp-2.0.5/test/test_download.rb +252 -0
  115. data/vendor/net-sftp-2.0.5/test/test_file.rb +159 -0
  116. data/vendor/net-sftp-2.0.5/test/test_file_factory.rb +48 -0
  117. data/vendor/net-sftp-2.0.5/test/test_packet.rb +9 -0
  118. data/vendor/net-sftp-2.0.5/test/test_protocol.rb +17 -0
  119. data/vendor/net-sftp-2.0.5/test/test_request.rb +71 -0
  120. data/vendor/net-sftp-2.0.5/test/test_response.rb +53 -0
  121. data/vendor/net-sftp-2.0.5/test/test_session.rb +741 -0
  122. data/vendor/net-sftp-2.0.5/test/test_upload.rb +219 -0
  123. data/vendor/net-ssh-2.5.2/CHANGELOG.rdoc +295 -0
  124. data/vendor/net-ssh-2.5.2/LICENSE.rdoc +19 -0
  125. data/vendor/net-ssh-2.5.2/Manifest +132 -0
  126. data/vendor/net-ssh-2.5.2/README.rdoc +184 -0
  127. data/vendor/net-ssh-2.5.2/Rakefile +88 -0
  128. data/vendor/net-ssh-2.5.2/Rudyfile +96 -0
  129. data/vendor/net-ssh-2.5.2/THANKS.rdoc +19 -0
  130. data/vendor/net-ssh-2.5.2/lib/net/ssh.rb +223 -0
  131. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent.rb +23 -0
  132. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/java_pageant.rb +85 -0
  133. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/socket.rb +170 -0
  134. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/constants.rb +18 -0
  135. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/key_manager.rb +253 -0
  136. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  137. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/hostbased.rb +75 -0
  138. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/keyboard_interactive.rb +70 -0
  139. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/password.rb +43 -0
  140. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/publickey.rb +96 -0
  141. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/pageant.rb +264 -0
  142. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/session.rb +154 -0
  143. data/vendor/net-ssh-2.5.2/lib/net/ssh/buffer.rb +350 -0
  144. data/vendor/net-ssh-2.5.2/lib/net/ssh/buffered_io.rb +198 -0
  145. data/vendor/net-ssh-2.5.2/lib/net/ssh/config.rb +207 -0
  146. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/channel.rb +630 -0
  147. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/constants.rb +33 -0
  148. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/session.rb +597 -0
  149. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/term.rb +178 -0
  150. data/vendor/net-ssh-2.5.2/lib/net/ssh/errors.rb +88 -0
  151. data/vendor/net-ssh-2.5.2/lib/net/ssh/key_factory.rb +107 -0
  152. data/vendor/net-ssh-2.5.2/lib/net/ssh/known_hosts.rb +141 -0
  153. data/vendor/net-ssh-2.5.2/lib/net/ssh/loggable.rb +61 -0
  154. data/vendor/net-ssh-2.5.2/lib/net/ssh/packet.rb +102 -0
  155. data/vendor/net-ssh-2.5.2/lib/net/ssh/prompt.rb +93 -0
  156. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/command.rb +75 -0
  157. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/errors.rb +14 -0
  158. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/http.rb +94 -0
  159. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks4.rb +70 -0
  160. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks5.rb +142 -0
  161. data/vendor/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb +51 -0
  162. data/vendor/net-ssh-2.5.2/lib/net/ssh/service/forward.rb +298 -0
  163. data/vendor/net-ssh-2.5.2/lib/net/ssh/test.rb +89 -0
  164. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/channel.rb +129 -0
  165. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/extensions.rb +152 -0
  166. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/kex.rb +44 -0
  167. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/local_packet.rb +51 -0
  168. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/packet.rb +81 -0
  169. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/remote_packet.rb +38 -0
  170. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/script.rb +157 -0
  171. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/socket.rb +64 -0
  172. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/algorithms.rb +407 -0
  173. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/cipher_factory.rb +106 -0
  174. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/constants.rb +32 -0
  175. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/ctr.rb +95 -0
  176. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac.rb +45 -0
  177. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/abstract.rb +79 -0
  178. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5.rb +12 -0
  179. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  180. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/none.rb +15 -0
  181. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/ripemd160.rb +13 -0
  182. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  183. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  184. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256.rb +15 -0
  185. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256_96.rb +13 -0
  186. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512.rb +14 -0
  187. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512_96.rb +13 -0
  188. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/identity_cipher.rb +55 -0
  189. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex.rb +28 -0
  190. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +44 -0
  191. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +216 -0
  192. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +80 -0
  193. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +15 -0
  194. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +93 -0
  195. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +13 -0
  196. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +13 -0
  197. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/key_expander.rb +26 -0
  198. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/openssl.rb +237 -0
  199. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/packet_stream.rb +235 -0
  200. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/server_version.rb +71 -0
  201. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/session.rb +278 -0
  202. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/state.rb +206 -0
  203. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/lenient.rb +30 -0
  204. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/null.rb +12 -0
  205. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/strict.rb +53 -0
  206. data/vendor/net-ssh-2.5.2/lib/net/ssh/version.rb +62 -0
  207. data/vendor/net-ssh-2.5.2/net-ssh.gemspec +172 -0
  208. data/vendor/net-ssh-2.5.2/setup.rb +1585 -0
  209. data/vendor/net-ssh-2.5.2/support/arcfour_check.rb +20 -0
  210. data/vendor/net-ssh-2.5.2/support/ssh_tunnel_bug.rb +65 -0
  211. data/vendor/net-ssh-2.5.2/test/README.txt +43 -0
  212. data/vendor/net-ssh-2.5.2/test/authentication/methods/common.rb +28 -0
  213. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_abstract.rb +51 -0
  214. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_hostbased.rb +114 -0
  215. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_keyboard_interactive.rb +100 -0
  216. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_password.rb +52 -0
  217. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_publickey.rb +148 -0
  218. data/vendor/net-ssh-2.5.2/test/authentication/test_agent.rb +205 -0
  219. data/vendor/net-ssh-2.5.2/test/authentication/test_key_manager.rb +218 -0
  220. data/vendor/net-ssh-2.5.2/test/authentication/test_session.rb +106 -0
  221. data/vendor/net-ssh-2.5.2/test/common.rb +107 -0
  222. data/vendor/net-ssh-2.5.2/test/configs/eqsign +3 -0
  223. data/vendor/net-ssh-2.5.2/test/configs/exact_match +8 -0
  224. data/vendor/net-ssh-2.5.2/test/configs/host_plus +10 -0
  225. data/vendor/net-ssh-2.5.2/test/configs/multihost +4 -0
  226. data/vendor/net-ssh-2.5.2/test/configs/nohost +19 -0
  227. data/vendor/net-ssh-2.5.2/test/configs/numeric_host +4 -0
  228. data/vendor/net-ssh-2.5.2/test/configs/wild_cards +14 -0
  229. data/vendor/net-ssh-2.5.2/test/connection/test_channel.rb +467 -0
  230. data/vendor/net-ssh-2.5.2/test/connection/test_session.rb +488 -0
  231. data/vendor/net-ssh-2.5.2/test/known_hosts/github +1 -0
  232. data/vendor/net-ssh-2.5.2/test/manual/test_forward.rb +223 -0
  233. data/vendor/net-ssh-2.5.2/test/start/test_transport.rb +28 -0
  234. data/vendor/net-ssh-2.5.2/test/test_all.rb +9 -0
  235. data/vendor/net-ssh-2.5.2/test/test_buffer.rb +426 -0
  236. data/vendor/net-ssh-2.5.2/test/test_buffered_io.rb +63 -0
  237. data/vendor/net-ssh-2.5.2/test/test_config.rb +120 -0
  238. data/vendor/net-ssh-2.5.2/test/test_key_factory.rb +121 -0
  239. data/vendor/net-ssh-2.5.2/test/test_known_hosts.rb +13 -0
  240. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5.rb +39 -0
  241. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5_96.rb +25 -0
  242. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_none.rb +34 -0
  243. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_ripemd160.rb +34 -0
  244. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1.rb +34 -0
  245. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1_96.rb +25 -0
  246. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256.rb +35 -0
  247. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256_96.rb +25 -0
  248. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512.rb +35 -0
  249. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512_96.rb +25 -0
  250. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group14_sha1.rb +13 -0
  251. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
  252. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
  253. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +33 -0
  254. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp256.rb +161 -0
  255. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp384.rb +37 -0
  256. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp521.rb +37 -0
  257. data/vendor/net-ssh-2.5.2/test/transport/test_algorithms.rb +330 -0
  258. data/vendor/net-ssh-2.5.2/test/transport/test_cipher_factory.rb +441 -0
  259. data/vendor/net-ssh-2.5.2/test/transport/test_hmac.rb +34 -0
  260. data/vendor/net-ssh-2.5.2/test/transport/test_identity_cipher.rb +40 -0
  261. data/vendor/net-ssh-2.5.2/test/transport/test_packet_stream.rb +1745 -0
  262. data/vendor/net-ssh-2.5.2/test/transport/test_server_version.rb +78 -0
  263. data/vendor/net-ssh-2.5.2/test/transport/test_session.rb +315 -0
  264. data/vendor/net-ssh-2.5.2/test/transport/test_state.rb +179 -0
  265. metadata +325 -78
@@ -0,0 +1,153 @@
1
+ require 'test/unit'
2
+ require 'mocha'
3
+
4
+ begin
5
+ gem 'net-ssh', ">= 2.0.0"
6
+ require 'net/ssh'
7
+ rescue LoadError
8
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../net-ssh/lib"
9
+
10
+ begin
11
+ require 'net/ssh'
12
+ require 'net/ssh/version'
13
+ raise LoadError, "wrong version" unless Net::SSH::Version::STRING >= '1.99.0'
14
+ rescue LoadError => e
15
+ abort "could not load net/ssh v2 (#{e.inspect})"
16
+ end
17
+ end
18
+
19
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
20
+
21
+ require 'net/scp'
22
+ require 'net/ssh/test'
23
+
24
+ class Net::SSH::Test::Channel
25
+ def gets_ok
26
+ gets_data "\0"
27
+ end
28
+
29
+ def sends_ok
30
+ sends_data "\0"
31
+ end
32
+ end
33
+
34
+ class Net::SCP::TestCase < Test::Unit::TestCase
35
+ include Net::SSH::Test
36
+
37
+ def default_test
38
+ # do nothing, this is just a hacky-hack to work around Test::Unit's
39
+ # insistence that all TestCase subclasses have at least one test
40
+ # method defined.
41
+ end
42
+
43
+ protected
44
+
45
+ def prepare_file(path, contents="", mode=0666, mtime=Time.now, atime=Time.now)
46
+ entry = FileEntry.new(path, contents, mode, mtime, atime)
47
+ entry.stub!
48
+ entry
49
+ end
50
+
51
+ def prepare_directory(path, mode=0777, mtime=Time.now, atime=Time.now)
52
+ directory = DirectoryEntry.new(path, mode, mtime, atime)
53
+ yield directory if block_given?
54
+ directory.stub!
55
+ end
56
+
57
+ # The POSIX spec unfortunately allows all characters in file names except
58
+ # ASCII 0x00(NUL) and 0x2F(/)
59
+ #
60
+ # Ideally, we should be testing filenames with newlines, but Mocha doesn't
61
+ # like this at all, so we leave them out. However, the Shellwords module
62
+ # handles newlines just fine, so we can be reasonably confident that they
63
+ # will work in practice
64
+ def awful_file_name
65
+ (((0x00..0x7f).to_a - [0x00, 0x0a, 0x2f]).map { |n| n.chr }).join + '.txt'
66
+ end
67
+
68
+ def escaped_file_name
69
+ "\\\001\\\002\\\003\\\004\\\005\\\006\\\a\\\b\\\t\\\v\\\f\\\r\\\016\\\017\\\020\\\021\\\022\\\023\\\024\\\025\\\026\\\027\\\030\\\031\\\032\\\e\\\034\\\035\\\036\\\037\\ \\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+,-.0123456789:\\;\\<\\=\\>\\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[\\\\\\]\\^_\\`abcdefghijklmnopqrstuvwxyz\\{\\|\\}\\~\\\177.txt"
70
+ end
71
+
72
+ class FileEntry
73
+ attr_reader :path, :contents, :mode, :mtime, :atime, :io
74
+
75
+ def initialize(path, contents, mode=0666, mtime=Time.now, atime=Time.now)
76
+ @path, @contents, @mode = path, contents, mode
77
+ @mtime, @atime = mtime, atime
78
+ end
79
+
80
+ def name
81
+ @name ||= File.basename(path)
82
+ end
83
+
84
+ def stub!
85
+ stat = Mocha::Mock.new("file::stat")
86
+ stat.stubs(:size => contents.length, :mode => mode, :mtime => mtime, :atime => atime, :directory? => false)
87
+
88
+ File.stubs(:stat).with(path).returns(stat)
89
+ File.stubs(:directory?).with(path).returns(false)
90
+ File.stubs(:file?).with(path).returns(true)
91
+ File.stubs(:open).with(path, "rb").returns(StringIO.new(contents))
92
+
93
+ @io = StringIO.new
94
+ File.stubs(:new).with(path, "wb", mode).returns(io)
95
+ end
96
+ end
97
+
98
+ class DirectoryEntry
99
+ attr_reader :path, :mode, :mtime, :atime
100
+ attr_reader :entries
101
+
102
+ def initialize(path, mode=0777, mtime=Time.now, atime=Time.now)
103
+ @path, @mode = path, mode
104
+ @mtime, @atime = mtime, atime
105
+ @entries = []
106
+ end
107
+
108
+ def name
109
+ @name ||= File.basename(path)
110
+ end
111
+
112
+ def file(name, *args)
113
+ (entries << FileEntry.new(File.join(path, name), *args)).last
114
+ end
115
+
116
+ def directory(name, *args)
117
+ entry = DirectoryEntry.new(File.join(path, name), *args)
118
+ yield entry if block_given?
119
+ (entries << entry).last
120
+ end
121
+
122
+ def stub!
123
+ Dir.stubs(:mkdir).with { |*a| a.first == path }
124
+
125
+ stat = Mocha::Mock.new("file::stat")
126
+ stat.stubs(:size => 1024, :mode => mode, :mtime => mtime, :atime => atime, :directory? => true)
127
+
128
+ File.stubs(:stat).with(path).returns(stat)
129
+ File.stubs(:directory?).with(path).returns(true)
130
+ File.stubs(:file?).with(path).returns(false)
131
+ Dir.stubs(:entries).with(path).returns(%w(. ..) + entries.map { |e| e.name }.sort)
132
+
133
+ entries.each { |e| e.stub! }
134
+ end
135
+ end
136
+
137
+ def expect_scp_session(arguments)
138
+ story do |session|
139
+ channel = session.opens_channel
140
+ channel.sends_exec "scp #{arguments}"
141
+ yield channel if block_given?
142
+ channel.sends_eof
143
+ channel.gets_exit_status
144
+ channel.gets_eof
145
+ channel.gets_close
146
+ channel.sends_close
147
+ end
148
+ end
149
+
150
+ def scp(options={})
151
+ @scp ||= Net::SCP.new(connection(options))
152
+ end
153
+ end
@@ -0,0 +1,3 @@
1
+ Dir.chdir(File.dirname(__FILE__)) do
2
+ Dir['**/test_*.rb'].each { |file| require(file) }
3
+ end
@@ -0,0 +1,170 @@
1
+ require 'common'
2
+
3
+ class TestDownload < Net::SCP::TestCase
4
+ def test_download_file_should_transfer_file
5
+ file = prepare_file("/path/to/local.txt", "a" * 1234)
6
+
7
+ expect_scp_session "-f /path/to/remote.txt" do |channel|
8
+ simple_download(channel)
9
+ end
10
+
11
+ assert_scripted { scp.download!("/path/to/remote.txt", "/path/to/local.txt") }
12
+ assert_equal "a" * 1234, file.io.string
13
+ end
14
+
15
+ def test_download_file_with_spaces_in_name_should_escape_remote_file_name
16
+ file = prepare_file("/path/to/local file.txt", "")
17
+
18
+ expect_scp_session "-f /path/to/remote\\ file.txt" do |channel|
19
+ channel.sends_ok
20
+ channel.gets_data "C0666 0 local file.txt\n"
21
+ channel.sends_ok
22
+ channel.gets_ok
23
+ channel.sends_ok
24
+ end
25
+
26
+ assert_scripted { scp.download!("/path/to/remote file.txt", "/path/to/local file.txt") }
27
+ end
28
+
29
+ def test_download_file_with_metacharacters_in_name_should_escape_remote_file_name
30
+ file = prepare_file("/path/to/local/#{awful_file_name}", "")
31
+
32
+ expect_scp_session "-f /path/to/remote/#{escaped_file_name}" do |channel|
33
+ channel.sends_ok
34
+ channel.gets_data "C0666 0 #{awful_file_name}\n"
35
+ channel.sends_ok
36
+ channel.gets_ok
37
+ channel.sends_ok
38
+ end
39
+
40
+ assert_scripted { scp.download!("/path/to/remote/#{awful_file_name}", "/path/to/local/#{awful_file_name}") }
41
+ end
42
+
43
+ def test_download_with_preserve_should_send_times
44
+ file = prepare_file("/path/to/local.txt", "a" * 1234, 0644, Time.at(1234567890, 123456), Time.at(12121212, 232323))
45
+
46
+ expect_scp_session "-f -p /path/to/remote.txt" do |channel|
47
+ channel.sends_ok
48
+ channel.gets_data "T1234567890 123456 12121212 232323\n"
49
+ simple_download(channel, 0644)
50
+ end
51
+
52
+ File.expects(:utime).with(Time.at(12121212, 232323), Time.at(1234567890, 123456), "/path/to/local.txt")
53
+ assert_scripted { scp.download!("/path/to/remote.txt", "/path/to/local.txt", :preserve => true) }
54
+ assert_equal "a" * 1234, file.io.string
55
+ end
56
+
57
+ def test_download_with_progress_callback_should_invoke_callback
58
+ prepare_file("/path/to/local.txt", "a" * 3000 + "b" * 3000 + "c" * 3000 + "d" * 3000)
59
+
60
+ expect_scp_session "-f /path/to/remote.txt" do |channel|
61
+ channel.sends_ok
62
+ channel.gets_data "C0666 12000 remote.txt\n"
63
+ channel.sends_ok
64
+ channel.gets_data "a" * 3000
65
+ channel.inject_remote_delay!
66
+ channel.gets_data "b" * 3000
67
+ channel.inject_remote_delay!
68
+ channel.gets_data "c" * 3000
69
+ channel.inject_remote_delay!
70
+ channel.gets_data "d" * 3000
71
+ channel.gets_ok
72
+ channel.sends_ok
73
+ end
74
+
75
+ calls = []
76
+ progress = Proc.new { |ch, *args| calls << args }
77
+
78
+ assert_scripted do
79
+ scp.download!("/path/to/remote.txt", "/path/to/local.txt", &progress)
80
+ end
81
+
82
+ assert_equal ["/path/to/local.txt", 0, 12000], calls.shift
83
+ assert_equal ["/path/to/local.txt", 3000, 12000], calls.shift
84
+ assert_equal ["/path/to/local.txt", 6000, 12000], calls.shift
85
+ assert_equal ["/path/to/local.txt", 9000, 12000], calls.shift
86
+ assert_equal ["/path/to/local.txt", 12000, 12000], calls.shift
87
+ assert calls.empty?
88
+ end
89
+
90
+ def test_download_io_with_recursive_should_raise_error
91
+ expect_scp_session "-f -r /path/to/remote.txt"
92
+ assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", StringIO.new, :recursive => true) }
93
+ end
94
+
95
+ def test_download_io_with_preserve_should_ignore_preserve
96
+ expect_scp_session "-f -p /path/to/remote.txt" do |channel|
97
+ simple_download(channel)
98
+ end
99
+
100
+ io = StringIO.new
101
+ assert_scripted { scp.download!("/path/to/remote.txt", io, :preserve => true) }
102
+ assert_equal "a" * 1234, io.string
103
+ end
104
+
105
+ def test_download_io_should_transfer_data
106
+ expect_scp_session "-f /path/to/remote.txt" do |channel|
107
+ simple_download(channel)
108
+ end
109
+
110
+ io = StringIO.new
111
+ assert_scripted { scp.download!("/path/to/remote.txt", io) }
112
+ assert_equal "a" * 1234, io.string
113
+ end
114
+
115
+ def test_download_bang_without_target_should_return_string
116
+ expect_scp_session "-f /path/to/remote.txt" do |channel|
117
+ simple_download(channel)
118
+ end
119
+
120
+ assert_scripted do
121
+ assert_equal "a" * 1234, scp.download!("/path/to/remote.txt")
122
+ end
123
+ end
124
+
125
+ def test_download_directory_without_recursive_should_raise_error
126
+ expect_scp_session "-f /path/to/remote" do |channel|
127
+ channel.sends_ok
128
+ channel.gets_data "D0755 0 remote\n"
129
+ end
130
+
131
+ assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") }
132
+ end
133
+
134
+ def test_download_directory_should_create_directory_and_files_locally
135
+ file = nil
136
+ prepare_directory "/path/to/local" do |dir|
137
+ dir.directory "remote" do |dir2|
138
+ dir2.directory "sub" do |dir3|
139
+ file = dir3.file "remote.txt", ""
140
+ end
141
+ end
142
+ end
143
+
144
+ expect_scp_session "-f -r /path/to/remote" do |channel|
145
+ channel.sends_ok
146
+ channel.gets_data "D0755 0 remote\n"
147
+ channel.sends_ok
148
+ channel.gets_data "D0755 0 sub\n"
149
+ simple_download(channel)
150
+ channel.gets_data "E\n"
151
+ channel.sends_ok
152
+ channel.gets_data "E\n"
153
+ channel.sends_ok
154
+ end
155
+
156
+ scp.download!("/path/to/remote", "/path/to/local", :recursive => true, :ssh => { :verbose => :debug })
157
+ assert_equal "a" * 1234, file.io.string
158
+ end
159
+
160
+ private
161
+
162
+ def simple_download(channel, mode=0666)
163
+ channel.sends_ok
164
+ channel.gets_data "C%04o 1234 remote.txt\n" % mode
165
+ channel.sends_ok
166
+ channel.gets_data "a" * 1234
167
+ channel.gets_ok
168
+ channel.sends_ok
169
+ end
170
+ end
@@ -0,0 +1,60 @@
1
+ require 'common'
2
+
3
+ class TestSCP < Net::SCP::TestCase
4
+ def test_start_without_block_should_return_scp_instance
5
+ ssh = stub('session', :logger => nil)
6
+ Net::SSH.expects(:start).
7
+ with("remote.host", "username", :password => "foo").
8
+ returns(ssh)
9
+
10
+ ssh.expects(:close).never
11
+ scp = Net::SCP.start("remote.host", "username", :password => "foo")
12
+ assert_instance_of Net::SCP, scp
13
+ assert_equal ssh, scp.session
14
+ end
15
+
16
+ def test_start_with_block_should_yield_scp_and_close_ssh_session
17
+ ssh = stub('session', :logger => nil)
18
+ Net::SSH.expects(:start).
19
+ with("remote.host", "username", :password => "foo").
20
+ returns(ssh)
21
+
22
+ ssh.expects(:loop)
23
+ ssh.expects(:close)
24
+
25
+ yielded = false
26
+ Net::SCP.start("remote.host", "username", :password => "foo") do |scp|
27
+ yielded = true
28
+ assert_instance_of Net::SCP, scp
29
+ assert_equal ssh, scp.session
30
+ end
31
+
32
+ assert yielded
33
+ end
34
+
35
+ def test_self_upload_should_instatiate_scp_and_invoke_synchronous_upload
36
+ scp = stub('scp')
37
+ scp.expects(:upload!).with("/path/to/local", "/path/to/remote", :recursive => true)
38
+
39
+ Net::SCP.expects(:start).
40
+ with("remote.host", "username", :password => "foo").
41
+ yields(scp)
42
+
43
+ Net::SCP.upload!("remote.host", "username", "/path/to/local", "/path/to/remote",
44
+ :ssh => { :password => "foo" }, :recursive => true)
45
+ end
46
+
47
+ def test_self_download_should_instatiate_scp_and_invoke_synchronous_download
48
+ scp = stub('scp')
49
+ scp.expects(:download!).with("/path/to/remote", "/path/to/local", :recursive => true).returns(:result)
50
+
51
+ Net::SCP.expects(:start).
52
+ with("remote.host", "username", :password => "foo").
53
+ yields(scp)
54
+
55
+ result = Net::SCP.download!("remote.host", "username", "/path/to/remote", "/path/to/local",
56
+ :ssh => { :password => "foo" }, :recursive => true)
57
+
58
+ assert_equal :result, result
59
+ end
60
+ end
@@ -0,0 +1,269 @@
1
+ require 'common'
2
+
3
+ class TestUpload < Net::SCP::TestCase
4
+ def test_upload_file_should_transfer_file
5
+ prepare_file("/path/to/local.txt", "a" * 1234)
6
+
7
+ expect_scp_session "-t /path/to/remote.txt" do |channel|
8
+ channel.gets_ok
9
+ channel.sends_data "C0666 1234 local.txt\n"
10
+ channel.gets_ok
11
+ channel.sends_data "a" * 1234
12
+ channel.sends_ok
13
+ channel.gets_ok
14
+ end
15
+
16
+ assert_scripted { scp.upload!("/path/to/local.txt", "/path/to/remote.txt") }
17
+ end
18
+
19
+ def test_upload_file_with_spaces_in_name_should_escape_remote_file_name
20
+ prepare_file("/path/to/local file.txt", "")
21
+
22
+ expect_scp_session "-t /path/to/remote\\ file.txt" do |channel|
23
+ channel.gets_ok
24
+ channel.sends_data "C0666 0 local file.txt\n"
25
+ channel.gets_ok
26
+ channel.sends_ok
27
+ channel.gets_ok
28
+ end
29
+
30
+ assert_scripted { scp.upload!("/path/to/local file.txt", "/path/to/remote file.txt") }
31
+ end
32
+
33
+ def test_upload_file_with_metacharacters_in_name_should_escape_remote_file_name
34
+ prepare_file("/path/to/local/#{awful_file_name}", "")
35
+
36
+ expect_scp_session "-t /path/to/remote/#{escaped_file_name}" do |channel|
37
+ channel.gets_ok
38
+ channel.sends_data "C0666 0 #{awful_file_name}\n"
39
+ channel.gets_ok
40
+ channel.sends_ok
41
+ channel.gets_ok
42
+ end
43
+
44
+ assert_scripted { scp.upload!("/path/to/local/#{awful_file_name}", "/path/to/remote/#{awful_file_name}") }
45
+ end
46
+
47
+ def test_upload_file_with_preserve_should_send_times
48
+ prepare_file("/path/to/local.txt", "a" * 1234, 0666, Time.at(1234567890, 123456), Time.at(1234543210, 345678))
49
+
50
+ expect_scp_session "-t -p /path/to/remote.txt" do |channel|
51
+ channel.gets_ok
52
+ channel.sends_data "T1234567890 123456 1234543210 345678\n"
53
+ channel.gets_ok
54
+ channel.sends_data "C0666 1234 local.txt\n"
55
+ channel.gets_ok
56
+ channel.sends_data "a" * 1234
57
+ channel.sends_ok
58
+ channel.gets_ok
59
+ end
60
+
61
+ assert_scripted { scp.upload!("/path/to/local.txt", "/path/to/remote.txt", :preserve => true) }
62
+ end
63
+
64
+ def test_upload_file_with_progress_callback_should_invoke_callback
65
+ prepare_file("/path/to/local.txt", "a" * 3000 + "b" * 3000 + "c" * 3000 + "d" * 3000)
66
+
67
+ expect_scp_session "-t /path/to/remote.txt" do |channel|
68
+ channel.gets_ok
69
+ channel.sends_data "C0666 12000 local.txt\n"
70
+ channel.gets_ok
71
+ channel.sends_data "a" * 3000
72
+ channel.sends_data "b" * 3000
73
+ channel.sends_data "c" * 3000
74
+ channel.sends_data "d" * 3000
75
+ channel.sends_ok
76
+ channel.gets_ok
77
+ end
78
+
79
+ calls = []
80
+ progress = Proc.new do |ch, name, sent, total|
81
+ calls << [name, sent, total]
82
+ end
83
+
84
+ assert_scripted do
85
+ scp.upload!("/path/to/local.txt", "/path/to/remote.txt", :chunk_size => 3000, &progress)
86
+ end
87
+
88
+ assert_equal ["/path/to/local.txt", 0, 12000], calls.shift
89
+ assert_equal ["/path/to/local.txt", 3000, 12000], calls.shift
90
+ assert_equal ["/path/to/local.txt", 6000, 12000], calls.shift
91
+ assert_equal ["/path/to/local.txt", 9000, 12000], calls.shift
92
+ assert_equal ["/path/to/local.txt", 12000, 12000], calls.shift
93
+ assert calls.empty?
94
+ end
95
+
96
+ def test_upload_io_with_recursive_should_ignore_recursive
97
+ expect_scp_session "-t -r /path/to/remote.txt" do |channel|
98
+ channel.gets_ok
99
+ channel.sends_data "C0640 1234 remote.txt\n"
100
+ channel.gets_ok
101
+ channel.sends_data "a" * 1234
102
+ channel.sends_ok
103
+ channel.gets_ok
104
+ end
105
+
106
+ io = StringIO.new("a" * 1234)
107
+ assert_scripted { scp.upload!(io, "/path/to/remote.txt", :recursive => true) }
108
+ end
109
+
110
+ def test_upload_io_with_preserve_should_ignore_preserve
111
+ expect_scp_session "-t -p /path/to/remote.txt" do |channel|
112
+ channel.gets_ok
113
+ channel.sends_data "C0640 1234 remote.txt\n"
114
+ channel.gets_ok
115
+ channel.sends_data "a" * 1234
116
+ channel.sends_ok
117
+ channel.gets_ok
118
+ end
119
+
120
+ io = StringIO.new("a" * 1234)
121
+ assert_scripted { scp.upload!(io, "/path/to/remote.txt", :preserve => true) }
122
+ end
123
+
124
+ def test_upload_io_should_transfer_data
125
+ expect_scp_session "-t /path/to/remote.txt" do |channel|
126
+ channel.gets_ok
127
+ channel.sends_data "C0640 1234 remote.txt\n"
128
+ channel.gets_ok
129
+ channel.sends_data "a" * 1234
130
+ channel.sends_ok
131
+ channel.gets_ok
132
+ end
133
+
134
+ io = StringIO.new("a" * 1234)
135
+ assert_scripted { scp.upload!(io, "/path/to/remote.txt") }
136
+ end
137
+
138
+ def test_upload_io_with_mode_should_honor_mode_as_permissions
139
+ expect_scp_session "-t /path/to/remote.txt" do |channel|
140
+ channel.gets_ok
141
+ channel.sends_data "C0666 1234 remote.txt\n"
142
+ channel.gets_ok
143
+ channel.sends_data "a" * 1234
144
+ channel.sends_ok
145
+ channel.gets_ok
146
+ end
147
+
148
+ io = StringIO.new("a" * 1234)
149
+ assert_scripted { scp.upload!(io, "/path/to/remote.txt", :mode => 0666) }
150
+ end
151
+
152
+ def test_upload_directory_without_recursive_should_error
153
+ prepare_directory("/path/to/local")
154
+
155
+ expect_scp_session("-t /path/to/remote") do |channel|
156
+ channel.gets_ok
157
+ end
158
+
159
+ assert_raises(Net::SCP::Error) { scp.upload!("/path/to/local", "/path/to/remote") }
160
+ end
161
+
162
+ def test_upload_empty_directory_should_create_directory_and_finish
163
+ prepare_directory("/path/to/local")
164
+
165
+ expect_scp_session("-t -r /path/to/remote") do |channel|
166
+ channel.gets_ok
167
+ channel.sends_data "D0777 0 local\n"
168
+ channel.gets_ok
169
+ channel.sends_data "E\n"
170
+ channel.gets_ok
171
+ end
172
+
173
+ assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :recursive => true) }
174
+ end
175
+
176
+ def test_upload_directory_should_recursively_create_and_upload_items
177
+ prepare_directory("/path/to/local") do |d|
178
+ d.file "hello.txt", "hello world\n"
179
+ d.directory "others" do |d2|
180
+ d2.file "data.dat", "abcdefghijklmnopqrstuvwxyz"
181
+ end
182
+ d.file "zoo.doc", "going to the zoo\n"
183
+ end
184
+
185
+ expect_scp_session("-t -r /path/to/remote") do |channel|
186
+ channel.gets_ok
187
+ channel.sends_data "D0777 0 local\n"
188
+ channel.gets_ok
189
+ channel.sends_data "C0666 12 hello.txt\n"
190
+ channel.gets_ok
191
+ channel.sends_data "hello world\n"
192
+ channel.sends_ok
193
+ channel.gets_ok
194
+ channel.sends_data "D0777 0 others\n"
195
+ channel.gets_ok
196
+ channel.sends_data "C0666 26 data.dat\n"
197
+ channel.gets_ok
198
+ channel.sends_data "abcdefghijklmnopqrstuvwxyz"
199
+ channel.sends_ok
200
+ channel.gets_ok
201
+ channel.sends_data "E\n"
202
+ channel.gets_ok
203
+ channel.sends_data "C0666 17 zoo.doc\n"
204
+ channel.gets_ok
205
+ channel.sends_data "going to the zoo\n"
206
+ channel.sends_ok
207
+ channel.gets_ok
208
+ channel.sends_data "E\n"
209
+ channel.gets_ok
210
+ end
211
+
212
+ assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :recursive => true) }
213
+ end
214
+
215
+ def test_upload_directory_with_preserve_should_send_times_for_all_items
216
+ prepare_directory("/path/to/local", 0755, Time.at(17171717, 191919), Time.at(18181818, 101010)) do |d|
217
+ d.file "hello.txt", "hello world\n", 0640, Time.at(12345, 67890), Time.at(234567, 890)
218
+ d.directory "others", 0770, Time.at(112233, 4455), Time.at(22334455, 667788) do |d2|
219
+ d2.file "data.dat", "abcdefghijklmnopqrstuvwxyz", 0600, Time.at(13579135, 13131), Time.at(7654321, 654321)
220
+ end
221
+ d.file "zoo.doc", "going to the zoo\n", 0444, Time.at(12121212, 131313), Time.at(23232323, 242424)
222
+ end
223
+
224
+ expect_scp_session("-t -r -p /path/to/remote") do |channel|
225
+ channel.gets_ok
226
+ channel.sends_data "T17171717 191919 18181818 101010\n"
227
+ channel.gets_ok
228
+ channel.sends_data "D0755 0 local\n"
229
+ channel.gets_ok
230
+ channel.sends_data "T12345 67890 234567 890\n"
231
+ channel.gets_ok
232
+ channel.sends_data "C0640 12 hello.txt\n"
233
+ channel.gets_ok
234
+ channel.sends_data "hello world\n"
235
+ channel.sends_ok
236
+ channel.gets_ok
237
+ channel.sends_data "T112233 4455 22334455 667788\n"
238
+ channel.gets_ok
239
+ channel.sends_data "D0770 0 others\n"
240
+ channel.gets_ok
241
+ channel.sends_data "T13579135 13131 7654321 654321\n"
242
+ channel.gets_ok
243
+ channel.sends_data "C0600 26 data.dat\n"
244
+ channel.gets_ok
245
+ channel.sends_data "abcdefghijklmnopqrstuvwxyz"
246
+ channel.sends_ok
247
+ channel.gets_ok
248
+ channel.sends_data "E\n"
249
+ channel.gets_ok
250
+ channel.sends_data "T12121212 131313 23232323 242424\n"
251
+ channel.gets_ok
252
+ channel.sends_data "C0444 17 zoo.doc\n"
253
+ channel.gets_ok
254
+ channel.sends_data "going to the zoo\n"
255
+ channel.sends_ok
256
+ channel.gets_ok
257
+ channel.sends_data "E\n"
258
+ channel.gets_ok
259
+ end
260
+
261
+ assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :preserve => true, :recursive => true) }
262
+ end
263
+
264
+ def test_upload_should_not_block
265
+ prepare_file("/path/to/local.txt", "data")
266
+ story { |s| s.opens_channel(false) }
267
+ assert_scripted { scp.upload("/path/to/local.txt", "/path/to/remote.txt") }
268
+ end
269
+ end