net-sftp 2.1.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +35 -0
- data/.gitignore +6 -0
- data/CHANGES.txt +4 -0
- data/Gemfile +15 -0
- data/README.rdoc +7 -4
- data/Rakefile +24 -30
- data/lib/net/sftp/operations/dir.rb +3 -3
- data/lib/net/sftp/operations/download.rb +8 -7
- data/lib/net/sftp/operations/file.rb +32 -9
- data/lib/net/sftp/operations/upload.rb +3 -3
- data/lib/net/sftp/session.rb +7 -5
- data/lib/net/sftp/version.rb +63 -13
- data/lib/net/sftp.rb +12 -4
- data/net-sftp-public_cert.pem +20 -0
- data/net-sftp.gemspec +35 -93
- data.tar.gz.sig +0 -0
- metadata +53 -82
- metadata.gz.sig +0 -0
- data/gem-public_cert.pem +0 -20
- data/test/common.rb +0 -184
- data/test/protocol/01/test_attributes.rb +0 -97
- data/test/protocol/01/test_base.rb +0 -210
- data/test/protocol/01/test_name.rb +0 -27
- data/test/protocol/02/test_base.rb +0 -26
- data/test/protocol/03/test_base.rb +0 -27
- data/test/protocol/04/test_attributes.rb +0 -148
- data/test/protocol/04/test_base.rb +0 -74
- data/test/protocol/04/test_name.rb +0 -53
- data/test/protocol/05/test_base.rb +0 -62
- data/test/protocol/06/test_attributes.rb +0 -124
- data/test/protocol/06/test_base.rb +0 -51
- data/test/protocol/test_base.rb +0 -42
- data/test/test_all.rb +0 -7
- data/test/test_dir.rb +0 -47
- data/test/test_download.rb +0 -287
- data/test/test_file.rb +0 -159
- data/test/test_file_factory.rb +0 -48
- data/test/test_packet.rb +0 -9
- data/test/test_protocol.rb +0 -17
- data/test/test_request.rb +0 -71
- data/test/test_response.rb +0 -53
- data/test/test_session.rb +0 -741
- data/test/test_upload.rb +0 -233
data/net-sftp.gemspec
CHANGED
@@ -1,106 +1,48 @@
|
|
1
|
-
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
require_relative 'lib/net/sftp/version'
|
5
2
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "net-sftp"
|
5
|
+
spec.version = Net::SFTP::Version::STRING
|
6
|
+
spec.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
|
7
|
+
spec.email = ["net-ssh@solutious.com"]
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
if ENV['NET_SSH_BUILDGEM_SIGNED']
|
10
|
+
spec.cert_chain = ["net-sftp-public_cert.pem"]
|
11
|
+
spec.signing_key = "/mnt/gem/net-ssh-private_key.pem"
|
12
|
+
end
|
13
|
+
|
14
|
+
spec.summary = %q{A pure Ruby implementation of the SFTP client protocol.}
|
15
|
+
spec.description = %q{A pure Ruby implementation of the SFTP client protocol}
|
16
|
+
spec.homepage = "https://github.com/net-ssh/net-sftp"
|
17
|
+
spec.license = "MIT"
|
18
|
+
spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version=
|
19
|
+
|
20
|
+
spec.extra_rdoc_files = [
|
17
21
|
"LICENSE.txt",
|
18
22
|
"README.rdoc"
|
19
23
|
]
|
20
|
-
s.files = [
|
21
|
-
"CHANGES.txt",
|
22
|
-
"LICENSE.txt",
|
23
|
-
"Manifest",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"gem-public_cert.pem",
|
27
|
-
"lib/net/sftp.rb",
|
28
|
-
"lib/net/sftp/constants.rb",
|
29
|
-
"lib/net/sftp/errors.rb",
|
30
|
-
"lib/net/sftp/operations/dir.rb",
|
31
|
-
"lib/net/sftp/operations/download.rb",
|
32
|
-
"lib/net/sftp/operations/file.rb",
|
33
|
-
"lib/net/sftp/operations/file_factory.rb",
|
34
|
-
"lib/net/sftp/operations/upload.rb",
|
35
|
-
"lib/net/sftp/packet.rb",
|
36
|
-
"lib/net/sftp/protocol.rb",
|
37
|
-
"lib/net/sftp/protocol/01/attributes.rb",
|
38
|
-
"lib/net/sftp/protocol/01/base.rb",
|
39
|
-
"lib/net/sftp/protocol/01/name.rb",
|
40
|
-
"lib/net/sftp/protocol/02/base.rb",
|
41
|
-
"lib/net/sftp/protocol/03/base.rb",
|
42
|
-
"lib/net/sftp/protocol/04/attributes.rb",
|
43
|
-
"lib/net/sftp/protocol/04/base.rb",
|
44
|
-
"lib/net/sftp/protocol/04/name.rb",
|
45
|
-
"lib/net/sftp/protocol/05/base.rb",
|
46
|
-
"lib/net/sftp/protocol/06/attributes.rb",
|
47
|
-
"lib/net/sftp/protocol/06/base.rb",
|
48
|
-
"lib/net/sftp/protocol/base.rb",
|
49
|
-
"lib/net/sftp/request.rb",
|
50
|
-
"lib/net/sftp/response.rb",
|
51
|
-
"lib/net/sftp/session.rb",
|
52
|
-
"lib/net/sftp/version.rb",
|
53
|
-
"net-sftp.gemspec",
|
54
|
-
"setup.rb",
|
55
|
-
"test/common.rb",
|
56
|
-
"test/protocol/01/test_attributes.rb",
|
57
|
-
"test/protocol/01/test_base.rb",
|
58
|
-
"test/protocol/01/test_name.rb",
|
59
|
-
"test/protocol/02/test_base.rb",
|
60
|
-
"test/protocol/03/test_base.rb",
|
61
|
-
"test/protocol/04/test_attributes.rb",
|
62
|
-
"test/protocol/04/test_base.rb",
|
63
|
-
"test/protocol/04/test_name.rb",
|
64
|
-
"test/protocol/05/test_base.rb",
|
65
|
-
"test/protocol/06/test_attributes.rb",
|
66
|
-
"test/protocol/06/test_base.rb",
|
67
|
-
"test/protocol/test_base.rb",
|
68
|
-
"test/test_all.rb",
|
69
|
-
"test/test_dir.rb",
|
70
|
-
"test/test_download.rb",
|
71
|
-
"test/test_file.rb",
|
72
|
-
"test/test_file_factory.rb",
|
73
|
-
"test/test_packet.rb",
|
74
|
-
"test/test_protocol.rb",
|
75
|
-
"test/test_request.rb",
|
76
|
-
"test/test_response.rb",
|
77
|
-
"test/test_session.rb",
|
78
|
-
"test/test_upload.rb"
|
79
|
-
]
|
80
|
-
s.homepage = "https://github.com/net-ssh/net-sftp"
|
81
|
-
s.licenses = ["MIT"]
|
82
|
-
s.require_paths = ["lib"]
|
83
|
-
s.rubyforge_project = "net-sftp"
|
84
|
-
s.rubygems_version = "1.8.25"
|
85
|
-
s.signing_key = "/mnt/gem/gem-private_key.pem"
|
86
|
-
s.summary = "A pure Ruby implementation of the SFTP client protocol"
|
87
24
|
|
88
|
-
|
89
|
-
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
if spec.respond_to? :specification_version then
|
31
|
+
spec.specification_version = 3
|
90
32
|
|
91
33
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
92
|
-
|
93
|
-
|
94
|
-
|
34
|
+
spec.add_runtime_dependency(%q<net-ssh>, [">= 5.0.0", "< 8.0.0"])
|
35
|
+
spec.add_development_dependency(%q<minitest>, [">= 5"])
|
36
|
+
spec.add_development_dependency(%q<mocha>, [">= 0"])
|
95
37
|
else
|
96
|
-
|
97
|
-
|
98
|
-
|
38
|
+
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 8.0.0"])
|
39
|
+
spec.add_dependency(%q<minitest>, [">= 5"])
|
40
|
+
spec.add_dependency(%q<mocha>, [">= 0"])
|
99
41
|
end
|
100
42
|
else
|
101
|
-
|
102
|
-
|
103
|
-
|
43
|
+
spec.add_dependency(%q<net-ssh>, [">= 5.0.0", "< 8.0.0"])
|
44
|
+
spec.add_dependency(%q<minitest>, [">= 5"])
|
45
|
+
spec.add_dependency(%q<test-unit>, [">= 0"])
|
46
|
+
spec.add_dependency(%q<mocha>, [">= 0"])
|
104
47
|
end
|
105
48
|
end
|
106
|
-
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,107 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-sftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 4.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jamis Buck
|
9
8
|
- Delano Mandelbaum
|
9
|
+
- Miklós Fazekas
|
10
10
|
autorequire:
|
11
|
-
bindir:
|
11
|
+
bindir: exe
|
12
12
|
cert_chain:
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
NW1pYkVsR1ZsT29iZi9naHFaMjVIUzlKNmtkMC9DL3J5MEFVdFRvZ3NMN1R4
|
36
|
-
R3dUNGtiQ3g2M3ViCjN2eXdFRWhzSlV6ZmQ5N0dDQUJtdFFmUlRsZFgvajdG
|
37
|
-
MXovNXdkOHAraGZkb3gxaWliZHM5WnRmYVpBM0t6S24Ka2NoV045QjZ6Zzly
|
38
|
-
MVhNUThCTTJKejBYb1BhblBlMzU0K2xXd2pwa1JLYkZvdy9aYlFIY0NMQ3Ey
|
39
|
-
NCtONmI2ZwpkZ0tmTkR6d2lEcHFDQT09Ci0tLS0tRU5EIENFUlRJRklDQVRF
|
40
|
-
LS0tLS0K
|
41
|
-
date: 2013-05-07 00:00:00.000000000 Z
|
13
|
+
- |
|
14
|
+
-----BEGIN CERTIF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GIy0dt7YezycVbzqtHoiI2Qf/bIFJQZ
|
30
|
+
mpJAAUBkRiWksE7zrsE5DGK8kL2GVos7f8kdM71zT8p7VBwkMdY277T29TG2xD0D
|
31
|
+
66Oev0C3/x89NXqCHkl1JElSzEFbOoxan16z7xNEf2MKcBKGhsYfzWVNyEtJm785
|
32
|
+
g+97rn/AuO6dcxJnW2qBGYQa7pQ=
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
42
35
|
dependencies:
|
43
36
|
- !ruby/object:Gem::Dependency
|
44
37
|
name: net-ssh
|
45
38
|
requirement: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
39
|
requirements:
|
48
|
-
- -
|
40
|
+
- - ">="
|
49
41
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
42
|
+
version: 5.0.0
|
43
|
+
- - "<"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 8.0.0
|
51
46
|
type: :runtime
|
52
47
|
prerelease: false
|
53
48
|
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
49
|
requirements:
|
56
|
-
- -
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 5.0.0
|
53
|
+
- - "<"
|
57
54
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
55
|
+
version: 8.0.0
|
59
56
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
57
|
+
name: minitest
|
61
58
|
requirement: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
59
|
requirements:
|
64
|
-
- -
|
60
|
+
- - ">="
|
65
61
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
62
|
+
version: '5'
|
67
63
|
type: :development
|
68
64
|
prerelease: false
|
69
65
|
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
66
|
requirements:
|
72
|
-
- -
|
67
|
+
- - ">="
|
73
68
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
69
|
+
version: '5'
|
75
70
|
- !ruby/object:Gem::Dependency
|
76
71
|
name: mocha
|
77
72
|
requirement: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
73
|
requirements:
|
80
|
-
- -
|
74
|
+
- - ">="
|
81
75
|
- !ruby/object:Gem::Version
|
82
76
|
version: '0'
|
83
77
|
type: :development
|
84
78
|
prerelease: false
|
85
79
|
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
80
|
requirements:
|
88
|
-
- -
|
81
|
+
- - ">="
|
89
82
|
- !ruby/object:Gem::Version
|
90
83
|
version: '0'
|
91
84
|
description: A pure Ruby implementation of the SFTP client protocol
|
92
|
-
email:
|
85
|
+
email:
|
86
|
+
- net-ssh@solutious.com
|
93
87
|
executables: []
|
94
88
|
extensions: []
|
95
89
|
extra_rdoc_files:
|
96
90
|
- LICENSE.txt
|
97
91
|
- README.rdoc
|
98
92
|
files:
|
93
|
+
- ".github/workflows/ci.yml"
|
94
|
+
- ".gitignore"
|
99
95
|
- CHANGES.txt
|
96
|
+
- Gemfile
|
100
97
|
- LICENSE.txt
|
101
98
|
- Manifest
|
102
99
|
- README.rdoc
|
103
100
|
- Rakefile
|
104
|
-
- gem-public_cert.pem
|
105
101
|
- lib/net/sftp.rb
|
106
102
|
- lib/net/sftp/constants.rb
|
107
103
|
- lib/net/sftp/errors.rb
|
@@ -128,55 +124,30 @@ files:
|
|
128
124
|
- lib/net/sftp/response.rb
|
129
125
|
- lib/net/sftp/session.rb
|
130
126
|
- lib/net/sftp/version.rb
|
127
|
+
- net-sftp-public_cert.pem
|
131
128
|
- net-sftp.gemspec
|
132
129
|
- setup.rb
|
133
|
-
- test/common.rb
|
134
|
-
- test/protocol/01/test_attributes.rb
|
135
|
-
- test/protocol/01/test_base.rb
|
136
|
-
- test/protocol/01/test_name.rb
|
137
|
-
- test/protocol/02/test_base.rb
|
138
|
-
- test/protocol/03/test_base.rb
|
139
|
-
- test/protocol/04/test_attributes.rb
|
140
|
-
- test/protocol/04/test_base.rb
|
141
|
-
- test/protocol/04/test_name.rb
|
142
|
-
- test/protocol/05/test_base.rb
|
143
|
-
- test/protocol/06/test_attributes.rb
|
144
|
-
- test/protocol/06/test_base.rb
|
145
|
-
- test/protocol/test_base.rb
|
146
|
-
- test/test_all.rb
|
147
|
-
- test/test_dir.rb
|
148
|
-
- test/test_download.rb
|
149
|
-
- test/test_file.rb
|
150
|
-
- test/test_file_factory.rb
|
151
|
-
- test/test_packet.rb
|
152
|
-
- test/test_protocol.rb
|
153
|
-
- test/test_request.rb
|
154
|
-
- test/test_response.rb
|
155
|
-
- test/test_session.rb
|
156
|
-
- test/test_upload.rb
|
157
130
|
homepage: https://github.com/net-ssh/net-sftp
|
158
131
|
licenses:
|
159
132
|
- MIT
|
133
|
+
metadata: {}
|
160
134
|
post_install_message:
|
161
135
|
rdoc_options: []
|
162
136
|
require_paths:
|
163
137
|
- lib
|
164
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
139
|
requirements:
|
167
|
-
- -
|
140
|
+
- - ">="
|
168
141
|
- !ruby/object:Gem::Version
|
169
142
|
version: '0'
|
170
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
-
none: false
|
172
144
|
requirements:
|
173
|
-
- -
|
145
|
+
- - ">="
|
174
146
|
- !ruby/object:Gem::Version
|
175
147
|
version: '0'
|
176
148
|
requirements: []
|
177
|
-
|
178
|
-
rubygems_version: 1.8.25
|
149
|
+
rubygems_version: 3.1.6
|
179
150
|
signing_key:
|
180
151
|
specification_version: 3
|
181
|
-
summary: A pure Ruby implementation of the SFTP client protocol
|
152
|
+
summary: A pure Ruby implementation of the SFTP client protocol.
|
182
153
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/gem-public_cert.pem
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUF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|
17
|
-
3vywEEhsJUzfd97GCABmtQfRTldX/j7F1z/5wd8p+hfdox1iibds9ZtfaZA3KzKn
|
18
|
-
kchWN9B6zg9r1XMQ8BM2Jz0XoPanPe354+lWwjpkRKbFow/ZbQHcCLCq24+N6b6g
|
19
|
-
dgKfNDzwiDpqCA==
|
20
|
-
-----END CERTIFICATE-----
|
data/test/common.rb
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'mocha/setup'
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'net/ssh'
|
7
|
-
require 'net/ssh/version'
|
8
|
-
raise LoadError, "wrong version" unless Net::SSH::Version::STRING >= '1.99.0'
|
9
|
-
rescue LoadError
|
10
|
-
begin
|
11
|
-
gem 'net-ssh', ">= 2.0.0"
|
12
|
-
require 'net/ssh'
|
13
|
-
rescue LoadError => e
|
14
|
-
abort "could not load net/ssh v2 (#{e.inspect})"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
19
|
-
require 'net/sftp'
|
20
|
-
require 'net/sftp/constants'
|
21
|
-
require 'net/ssh/test'
|
22
|
-
|
23
|
-
class Net::SFTP::TestCase < Test::Unit::TestCase
|
24
|
-
include Net::SFTP::Constants::PacketTypes
|
25
|
-
include Net::SSH::Test
|
26
|
-
|
27
|
-
def default_test
|
28
|
-
# do nothing, this is just hacky-hack to work around Test::Unit's
|
29
|
-
# insistence that all TestCase subclasses have at least one test
|
30
|
-
# method defined.
|
31
|
-
end
|
32
|
-
|
33
|
-
protected
|
34
|
-
|
35
|
-
def raw(*args)
|
36
|
-
Net::SSH::Buffer.from(*args).to_s
|
37
|
-
end
|
38
|
-
|
39
|
-
def sftp(options={})
|
40
|
-
@sftp ||= Net::SFTP::Session.new(connection(options))
|
41
|
-
end
|
42
|
-
|
43
|
-
def expect_sftp_session(opts={})
|
44
|
-
story do |session|
|
45
|
-
channel = session.opens_channel
|
46
|
-
channel.sends_subsystem("sftp")
|
47
|
-
channel.sends_packet(FXP_INIT, :long, opts[:client_version] || Net::SFTP::Session::HIGHEST_PROTOCOL_VERSION_SUPPORTED)
|
48
|
-
channel.gets_packet(FXP_VERSION, :long, opts[:server_version] || Net::SFTP::Session::HIGHEST_PROTOCOL_VERSION_SUPPORTED)
|
49
|
-
yield channel if block_given?
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def assert_scripted_command
|
54
|
-
assert_scripted do
|
55
|
-
sftp.connect!
|
56
|
-
yield
|
57
|
-
sftp.loop
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def assert_progress_reported_open(expect={})
|
62
|
-
assert_progress_reported(:open, expect)
|
63
|
-
end
|
64
|
-
|
65
|
-
def assert_progress_reported_put(offset, data, expect={})
|
66
|
-
assert_equal offset, current_event[3] if offset
|
67
|
-
assert_equal data, current_event[4] if data
|
68
|
-
assert_progress_reported(:put, expect)
|
69
|
-
end
|
70
|
-
|
71
|
-
def assert_progress_reported_get(offset, data, expect={})
|
72
|
-
assert_equal offset, current_event[3] if offset
|
73
|
-
if data.is_a?(Fixnum)
|
74
|
-
assert_equal data, current_event[4].length
|
75
|
-
elsif data
|
76
|
-
assert_equal data, current_event[4]
|
77
|
-
end
|
78
|
-
assert_progress_reported(:get, expect)
|
79
|
-
end
|
80
|
-
|
81
|
-
def assert_progress_reported_close(expect={})
|
82
|
-
assert_progress_reported(:close, expect)
|
83
|
-
end
|
84
|
-
|
85
|
-
def assert_progress_reported_mkdir(dir)
|
86
|
-
assert_equal dir, current_event[2]
|
87
|
-
assert_progress_reported(:mkdir)
|
88
|
-
end
|
89
|
-
|
90
|
-
def assert_progress_reported_finish
|
91
|
-
assert_progress_reported(:finish)
|
92
|
-
end
|
93
|
-
|
94
|
-
def assert_progress_reported(event, expect={})
|
95
|
-
assert_equal event, current_event[0]
|
96
|
-
expect.each do |key, value|
|
97
|
-
assert_equal value, current_event[2].send(key)
|
98
|
-
end
|
99
|
-
next_event!
|
100
|
-
end
|
101
|
-
|
102
|
-
def assert_no_more_reported_events
|
103
|
-
assert @progress.empty?, "expected #{@progress.empty?} to be empty"
|
104
|
-
end
|
105
|
-
|
106
|
-
def prepare_progress!
|
107
|
-
@progress = []
|
108
|
-
end
|
109
|
-
|
110
|
-
def record_progress(event)
|
111
|
-
@progress << event
|
112
|
-
end
|
113
|
-
|
114
|
-
def current_event
|
115
|
-
@progress.first
|
116
|
-
end
|
117
|
-
|
118
|
-
def next_event!
|
119
|
-
@progress.shift
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
class Net::SSH::Test::Channel
|
124
|
-
def gets_packet(type, *args)
|
125
|
-
gets_data(sftp_packet(type, *args))
|
126
|
-
end
|
127
|
-
|
128
|
-
def gets_packet_in_two(fragment_len, type, *args)
|
129
|
-
fragment_len ||= 0
|
130
|
-
whole_packet = sftp_packet(type, *args)
|
131
|
-
|
132
|
-
if 0 < fragment_len && fragment_len < whole_packet.length
|
133
|
-
gets_data(whole_packet[0, whole_packet.length - fragment_len])
|
134
|
-
gets_data(whole_packet[-fragment_len..-1])
|
135
|
-
else
|
136
|
-
gets_data(whole_packet)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def sends_packet(type, *args)
|
141
|
-
sends_data(sftp_packet(type, *args))
|
142
|
-
end
|
143
|
-
|
144
|
-
private
|
145
|
-
|
146
|
-
def sftp_packet(type, *args)
|
147
|
-
data = Net::SSH::Buffer.from(*args)
|
148
|
-
Net::SSH::Buffer.from(:long, data.length+1, :byte, type, :raw, data).to_s
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
class ProgressHandler
|
153
|
-
def initialize(progress_ref)
|
154
|
-
@progress = progress_ref
|
155
|
-
end
|
156
|
-
|
157
|
-
def on_open(*args)
|
158
|
-
@progress << [:open, *args]
|
159
|
-
end
|
160
|
-
|
161
|
-
def on_put(*args)
|
162
|
-
@progress << [:put, *args]
|
163
|
-
end
|
164
|
-
|
165
|
-
def on_close(*args)
|
166
|
-
@progress << [:close, *args]
|
167
|
-
end
|
168
|
-
|
169
|
-
def on_finish(*args)
|
170
|
-
@progress << [:finish, *args]
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# "prime the pump", so to speak: predefine the modules we need so we can
|
175
|
-
# define the test classes in a more elegant short-hand.
|
176
|
-
|
177
|
-
module Protocol
|
178
|
-
module V01; end
|
179
|
-
module V02; end
|
180
|
-
module V03; end
|
181
|
-
module V04; end
|
182
|
-
module V05; end
|
183
|
-
module V06; end
|
184
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'common'
|
2
|
-
|
3
|
-
module Etc; end
|
4
|
-
|
5
|
-
class Protocol::V01::TestAttributes < Net::SFTP::TestCase
|
6
|
-
def test_from_buffer_should_correctly_parse_buffer_and_return_attribute_object
|
7
|
-
attributes = attributes_factory.from_buffer(full_buffer)
|
8
|
-
|
9
|
-
assert_equal 1234567890, attributes.size
|
10
|
-
assert_equal 100, attributes.uid
|
11
|
-
assert_equal 200, attributes.gid
|
12
|
-
assert_equal 0755, attributes.permissions
|
13
|
-
assert_equal 1234567890, attributes.atime
|
14
|
-
assert_equal 2345678901, attributes.mtime
|
15
|
-
assert_equal "second", attributes.extended["first"]
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_from_buffer_should_correctly_parse_buffer_with_attribute_subset_and_return_attribute_object
|
19
|
-
buffer = Net::SSH::Buffer.from(:long, 0x4, :long, 0755)
|
20
|
-
|
21
|
-
attributes = attributes_factory.from_buffer(buffer)
|
22
|
-
|
23
|
-
assert_equal 0755, attributes.permissions
|
24
|
-
|
25
|
-
assert_nil attributes.size
|
26
|
-
assert_nil attributes.uid
|
27
|
-
assert_nil attributes.gid
|
28
|
-
assert_nil attributes.atime
|
29
|
-
assert_nil attributes.mtime
|
30
|
-
assert_nil attributes.extended
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_attributes_to_s_should_build_binary_representation
|
34
|
-
attributes = attributes_factory.new(
|
35
|
-
:size => 1234567890,
|
36
|
-
:uid => 100, :gid => 200,
|
37
|
-
:permissions => 0755,
|
38
|
-
:atime => 1234567890, :mtime => 2345678901,
|
39
|
-
:extended => { "first" => "second" })
|
40
|
-
|
41
|
-
assert_equal full_buffer.to_s, attributes.to_s
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_attributes_to_s_should_build_binary_representation_when_subset_is_present
|
45
|
-
attributes = attributes_factory.new(:permissions => 0755)
|
46
|
-
assert_equal Net::SSH::Buffer.from(:long, 0x4, :long, 0755).to_s, attributes.to_s
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_attributes_to_s_with_owner_and_group_should_translate_to_uid_and_gid
|
50
|
-
attributes = attributes_factory.new(:owner => "jamis", :group => "sftp")
|
51
|
-
attributes.expects(:require).with("etc").times(2)
|
52
|
-
Etc.expects(:getpwnam).with("jamis").returns(mock('user', :uid => 100))
|
53
|
-
Etc.expects(:getgrnam).with("sftp").returns(mock('group', :gid => 200))
|
54
|
-
assert_equal Net::SSH::Buffer.from(:long, 0x2, :long, 100, :long, 200).to_s, attributes.to_s
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_owner_should_translate_from_uid
|
58
|
-
attributes = attributes_factory.new(:uid => 100)
|
59
|
-
attributes.expects(:require).with("etc")
|
60
|
-
Etc.expects(:getpwuid).with(100).returns(mock('user', :name => "jamis"))
|
61
|
-
assert_equal "jamis", attributes.owner
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_group_should_translate_from_gid
|
65
|
-
attributes = attributes_factory.new(:gid => 200)
|
66
|
-
attributes.expects(:require).with("etc")
|
67
|
-
Etc.expects(:getgrgid).with(200).returns(mock('group', :name => "sftp"))
|
68
|
-
assert_equal "sftp", attributes.group
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_type_should_infer_type_from_permissions
|
72
|
-
assert_equal af::T_SOCKET, af.new(:permissions => 0140755).type
|
73
|
-
assert_equal af::T_SYMLINK, af.new(:permissions => 0120755).type
|
74
|
-
assert_equal af::T_REGULAR, af.new(:permissions => 0100755).type
|
75
|
-
assert_equal af::T_BLOCK_DEVICE, af.new(:permissions => 060755).type
|
76
|
-
assert_equal af::T_DIRECTORY, af.new(:permissions => 040755).type
|
77
|
-
assert_equal af::T_CHAR_DEVICE, af.new(:permissions => 020755).type
|
78
|
-
assert_equal af::T_FIFO, af.new(:permissions => 010755).type
|
79
|
-
assert_equal af::T_UNKNOWN, af.new(:permissions => 0755).type
|
80
|
-
assert_equal af::T_UNKNOWN, af.new.type
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
|
85
|
-
def full_buffer
|
86
|
-
Net::SSH::Buffer.from(:long, 0x8000000f,
|
87
|
-
:int64, 1234567890, :long, 100, :long, 200,
|
88
|
-
:long, 0755, :long, 1234567890, :long, 2345678901,
|
89
|
-
:long, 1, :string, "first", :string, "second")
|
90
|
-
end
|
91
|
-
|
92
|
-
def attributes_factory
|
93
|
-
Net::SFTP::Protocol::V01::Attributes
|
94
|
-
end
|
95
|
-
|
96
|
-
alias af attributes_factory
|
97
|
-
end
|