ftpd 2.0.1 → 2.0.2
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 +4 -4
- data/Changelog.md +6 -0
- data/Gemfile +2 -15
- data/Gemfile.lock +12 -51
- data/README.md +12 -0
- data/VERSION +1 -1
- data/bin/ftpdrb +17 -12
- data/examples/write_only.rb +61 -0
- data/ftpd.gemspec +59 -261
- data/lib/ftpd/session.rb +51 -51
- metadata +11 -153
- data/.travis.yml +0 -6
- data/features/example/eplf.feature +0 -14
- data/features/example/example.feature +0 -18
- data/features/example/read_only.feature +0 -63
- data/features/example/step_definitions/example_server.rb +0 -13
- data/features/ftp_server/abort.feature +0 -13
- data/features/ftp_server/allo.feature +0 -33
- data/features/ftp_server/append.feature +0 -94
- data/features/ftp_server/cdup.feature +0 -36
- data/features/ftp_server/command_errors.feature +0 -13
- data/features/ftp_server/concurrent_sessions.feature +0 -14
- data/features/ftp_server/delay_after_failed_login.feature +0 -23
- data/features/ftp_server/delete.feature +0 -60
- data/features/ftp_server/directory_navigation.feature +0 -59
- data/features/ftp_server/disconnect_after_failed_logins.feature +0 -25
- data/features/ftp_server/eprt.feature +0 -56
- data/features/ftp_server/epsv.feature +0 -37
- data/features/ftp_server/features.feature +0 -38
- data/features/ftp_server/file_structure.feature +0 -43
- data/features/ftp_server/get.feature +0 -80
- data/features/ftp_server/get_ipv6.feature +0 -46
- data/features/ftp_server/get_tls.feature +0 -23
- data/features/ftp_server/help.feature +0 -21
- data/features/ftp_server/implicit_tls.feature +0 -23
- data/features/ftp_server/invertability.feature +0 -15
- data/features/ftp_server/list.feature +0 -94
- data/features/ftp_server/list_tls.feature +0 -29
- data/features/ftp_server/logging.feature +0 -11
- data/features/ftp_server/login_auth_level_account.feature +0 -51
- data/features/ftp_server/login_auth_level_password.feature +0 -59
- data/features/ftp_server/login_auth_level_user.feature +0 -31
- data/features/ftp_server/max_connections.feature +0 -39
- data/features/ftp_server/mdtm.feature +0 -53
- data/features/ftp_server/mkdir.feature +0 -70
- data/features/ftp_server/mode.feature +0 -43
- data/features/ftp_server/name_list.feature +0 -77
- data/features/ftp_server/name_list_tls.feature +0 -30
- data/features/ftp_server/noop.feature +0 -17
- data/features/ftp_server/options.feature +0 -17
- data/features/ftp_server/pasv.feature +0 -30
- data/features/ftp_server/port.feature +0 -49
- data/features/ftp_server/put.feature +0 -79
- data/features/ftp_server/put_tls.feature +0 -23
- data/features/ftp_server/put_unique.feature +0 -56
- data/features/ftp_server/quit.feature +0 -23
- data/features/ftp_server/reinitialize.feature +0 -13
- data/features/ftp_server/rename.feature +0 -97
- data/features/ftp_server/rmdir.feature +0 -71
- data/features/ftp_server/site.feature +0 -13
- data/features/ftp_server/size.feature +0 -69
- data/features/ftp_server/status.feature +0 -18
- data/features/ftp_server/step_definitions/logging.rb +0 -10
- data/features/ftp_server/step_definitions/test_server.rb +0 -71
- data/features/ftp_server/structure_mount.feature +0 -13
- data/features/ftp_server/syntax_errors.feature +0 -18
- data/features/ftp_server/syst.feature +0 -18
- data/features/ftp_server/timeout.feature +0 -26
- data/features/ftp_server/type.feature +0 -59
- data/features/step_definitions/append.rb +0 -17
- data/features/step_definitions/client.rb +0 -27
- data/features/step_definitions/client_and_server_files.rb +0 -26
- data/features/step_definitions/client_files.rb +0 -16
- data/features/step_definitions/command.rb +0 -7
- data/features/step_definitions/connect.rb +0 -39
- data/features/step_definitions/delete.rb +0 -17
- data/features/step_definitions/directory_navigation.rb +0 -28
- data/features/step_definitions/error_replies.rb +0 -117
- data/features/step_definitions/features.rb +0 -23
- data/features/step_definitions/file_structure.rb +0 -18
- data/features/step_definitions/generic_send.rb +0 -11
- data/features/step_definitions/get.rb +0 -18
- data/features/step_definitions/help.rb +0 -20
- data/features/step_definitions/invalid_commands.rb +0 -13
- data/features/step_definitions/ipv6.rb +0 -11
- data/features/step_definitions/line_endings.rb +0 -9
- data/features/step_definitions/list.rb +0 -75
- data/features/step_definitions/login.rb +0 -84
- data/features/step_definitions/mkdir.rb +0 -11
- data/features/step_definitions/mode.rb +0 -17
- data/features/step_definitions/mtime.rb +0 -25
- data/features/step_definitions/noop.rb +0 -17
- data/features/step_definitions/options.rb +0 -11
- data/features/step_definitions/passive.rb +0 -10
- data/features/step_definitions/pending.rb +0 -5
- data/features/step_definitions/port.rb +0 -7
- data/features/step_definitions/put.rb +0 -31
- data/features/step_definitions/quit.rb +0 -17
- data/features/step_definitions/rename.rb +0 -13
- data/features/step_definitions/rmdir.rb +0 -11
- data/features/step_definitions/server_files.rb +0 -63
- data/features/step_definitions/server_title.rb +0 -14
- data/features/step_definitions/size.rb +0 -22
- data/features/step_definitions/status.rb +0 -11
- data/features/step_definitions/success_replies.rb +0 -9
- data/features/step_definitions/system.rb +0 -12
- data/features/step_definitions/timing.rb +0 -21
- data/features/step_definitions/type.rb +0 -17
- data/features/support/env.rb +0 -6
- data/features/support/example_server.rb +0 -69
- data/features/support/file_templates/ascii_unix +0 -4
- data/features/support/file_templates/ascii_windows +0 -4
- data/features/support/file_templates/binary +0 -0
- data/features/support/test_client.rb +0 -258
- data/features/support/test_file_templates.rb +0 -35
- data/features/support/test_server.rb +0 -304
- data/features/support/test_server_files.rb +0 -59
- data/rake_tasks/cucumber.rake +0 -9
- data/rake_tasks/default.rake +0 -1
- data/rake_tasks/jeweler.rake +0 -52
- data/rake_tasks/spec.rake +0 -3
- data/rake_tasks/test.rake +0 -2
- data/rake_tasks/yard.rake +0 -3
- data/spec/command_sequence_checker_spec.rb +0 -85
- data/spec/connection_throttle_spec.rb +0 -101
- data/spec/connection_tracker_spec.rb +0 -99
- data/spec/data_server_factory_spec.rb +0 -104
- data/spec/disk_file_system_spec.rb +0 -322
- data/spec/exception_translator_spec.rb +0 -38
- data/spec/file_info_spec.rb +0 -61
- data/spec/ftp_server_error_spec.rb +0 -15
- data/spec/list_format/eplf_spec.rb +0 -63
- data/spec/list_format/ls_spec.rb +0 -272
- data/spec/list_path_spec.rb +0 -23
- data/spec/null_logger_spec.rb +0 -26
- data/spec/protocols_spec.rb +0 -159
- data/spec/server_spec.rb +0 -83
- data/spec/spec_helper.rb +0 -17
- data/spec/telnet_spec.rb +0 -77
- data/spec/translate_exceptions_spec.rb +0 -42
- data/testlib/network.rb +0 -17
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
def unix_line_endings(exactly, s)
|
|
4
|
-
return s if exactly
|
|
5
|
-
s.gsub(/\r\n/, "\n")
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
Then /^the remote file "(.*?)" should( exactly)? match the local file$/ do
|
|
9
|
-
|remote_path, exactly|
|
|
10
|
-
local_path = File.basename(remote_path)
|
|
11
|
-
remote_contents = server.file_contents(remote_path)
|
|
12
|
-
local_contents = client.file_contents(local_path)
|
|
13
|
-
remote_contents = unix_line_endings(exactly, remote_contents)
|
|
14
|
-
local_contents = unix_line_endings(exactly, local_contents)
|
|
15
|
-
expect(remote_contents).to eq local_contents
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Then /^the local file "(.*?)" should( exactly)? match the remote file$/ do
|
|
19
|
-
|local_path, exactly|
|
|
20
|
-
remote_path = local_path
|
|
21
|
-
remote_contents = server.file_contents(remote_path)
|
|
22
|
-
local_contents = client.file_contents(local_path)
|
|
23
|
-
remote_contents = unix_line_endings(exactly, remote_contents)
|
|
24
|
-
local_contents = unix_line_endings(exactly, local_contents)
|
|
25
|
-
expect(local_contents).to eq remote_contents
|
|
26
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
Given /^the client has file "(.*?)"$/ do |local_path|
|
|
4
|
-
client.add_file local_path
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
Then /^the local file "(.*?)" should have (unix|windows) line endings$/ do
|
|
8
|
-
|local_path, line_ending_type|
|
|
9
|
-
expect(line_ending_type(client.file_contents(local_path))).to eq \
|
|
10
|
-
line_ending_type.to_sym
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
Then /^the local file "(.*?)" should match its template$/ do |local_path|
|
|
14
|
-
expect(client.template(local_path)).to eq \
|
|
15
|
-
client.file_contents(local_path)
|
|
16
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'double_bag_ftps'
|
|
4
|
-
require 'net/ftp'
|
|
5
|
-
|
|
6
|
-
When /^the( \w+)? client connects(?: with (\w+) TLS)?$/ do
|
|
7
|
-
|client_name, tls_mode|
|
|
8
|
-
tls_mode ||= 'off'
|
|
9
|
-
client(client_name).tls_mode = tls_mode.to_sym
|
|
10
|
-
client(client_name).start
|
|
11
|
-
client(client_name).connect(server.host, server.port)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
When /^the (\d+)rd client tries to connect$/ do |client_name|
|
|
15
|
-
client(client_name).start
|
|
16
|
-
capture_error do
|
|
17
|
-
client(client_name).connect(server.host, server.port)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
When /^the (\S+) client connects from (\S+)$/ do
|
|
22
|
-
|client_name, source_ip|
|
|
23
|
-
client(client_name).connect_from(source_ip, server.host, server.port)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
When /^the (\S+) client tries to connect from (\S+)$/ do
|
|
27
|
-
|client_name, source_ip|
|
|
28
|
-
capture_error do
|
|
29
|
-
step "the #{client_name} client connects from #{source_ip}"
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Then /^the client should be connected$/ do
|
|
34
|
-
expect(client).to be_connected
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
Then /^the client should not be connected$/ do
|
|
38
|
-
expect(client).to_not be_connected
|
|
39
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client deletes "(.*?)"$/ do |path|
|
|
4
|
-
capture_error do
|
|
5
|
-
step %Q(the client successfully deletes "#{path}")
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
When /^the client successfully deletes "(.*?)"$/ do |path|
|
|
10
|
-
client.delete path
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
When /^the client deletes with no path$/ do
|
|
14
|
-
capture_error do
|
|
15
|
-
client.raw 'DELE'
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client cd's to "(.*?)"$/ do |path|
|
|
4
|
-
capture_error do
|
|
5
|
-
step %Q(the client successfully cd's to "#{path}")
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# As of Ruby 1.9.3-p125, Net::FTP#chdir('..') will send a CDUP.
|
|
10
|
-
# However, that could conceivably change: The use of CDUP not
|
|
11
|
-
# required by the FTP protocol. Therefore we use this step to
|
|
12
|
-
# ensure that CDUP is sent and therefore tested.
|
|
13
|
-
|
|
14
|
-
When /^the client successfully cd's up$/ do
|
|
15
|
-
client.raw 'CDUP'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
When /^the client successfully cd's to "(.*?)"$/ do |path|
|
|
19
|
-
client.chdir path
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Then /^the current directory should be "(.*?)"$/ do |path|
|
|
23
|
-
expect(client.pwd).to eq path
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
Then /^the XPWD directory should be "(.*?)"$/ do |path|
|
|
27
|
-
expect(client.xpwd).to eq path
|
|
28
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
def capture_error
|
|
4
|
-
yield
|
|
5
|
-
@error = nil
|
|
6
|
-
rescue Net::FTPError => e
|
|
7
|
-
@error = e.message
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
Then /^the server returns no error$/ do
|
|
11
|
-
expect(@error).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Then /^the server returns a "(.*?)" error$/ do |error_message|
|
|
15
|
-
expect(@error || '').to include error_message
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Then /^the server returns a too many connections error$/ do
|
|
19
|
-
step 'the server returns a "421 Too many connections" error'
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Then /^the server returns a server unavailable error$/ do
|
|
23
|
-
step 'the server returns a "421 server unavailable" error'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
Then /^the server returns a not a directory error$/ do
|
|
27
|
-
step 'the server returns a "550 Not a directory" error'
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Then /^the server returns a login incorrect error$/ do
|
|
31
|
-
step 'the server returns a "530 Login incorrect" error'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
Then /^the server returns a not logged in error$/ do
|
|
35
|
-
step 'the server returns a "530 Not logged in" error'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
Then /^the server returns an access denied error$/ do
|
|
39
|
-
step 'the server returns a "550 Access denied" error'
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
Then /^the server returns a path required error$/ do
|
|
43
|
-
step 'the server returns a "501 Path required" error'
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
Then /^the server returns a not found error$/ do
|
|
47
|
-
step 'the server returns a "550 No such file or directory" error'
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
Then /^the server returns a syntax error$/ do
|
|
51
|
-
step 'the server returns a "501 Syntax error" error'
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
Then /^the server returns a bad option error$/ do
|
|
55
|
-
step 'the server returns a "501 Unsupported option" error'
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
Then /^the server returns a mode not implemented error$/ do
|
|
59
|
-
step 'the server returns a "504 Mode not implemented" error'
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
Then /^the server returns an invalid mode error$/ do
|
|
63
|
-
step 'the server returns a "504 Invalid mode code" error'
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
Then /^the server returns a file structure not implemented error$/ do
|
|
67
|
-
step 'the server returns a "504 Structure not implemented" error'
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
Then /^the server returns an invalid file structure error$/ do
|
|
71
|
-
step 'the server returns a "504 Invalid structure code" error'
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
Then /^the server returns a bad sequence error$/ do
|
|
75
|
-
step 'the server returns a "503 Bad sequence of commands" error'
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
Then /^the server returns a type not implemented error$/ do
|
|
79
|
-
step 'the server returns a "504 Type not implemented" error'
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
Then /^the server returns an invalid type error$/ do
|
|
83
|
-
step 'the server returns a "504 Invalid type code" error'
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
Then /^the server returns a format not implemented error$/ do
|
|
87
|
-
step 'the server returns a "504 Format not implemented" error'
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
Then /^the server returns an unimplemented parameter error$/ do
|
|
91
|
-
step('the server returns a "504 Command not '\
|
|
92
|
-
'implemented for that parameter" error')
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
Then /^the server returns a command unrecognized error$/ do
|
|
96
|
-
step 'the server returns a "500 Syntax error, command unrecognized" error'
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
Then /^the server returns an unimplemented command error$/ do
|
|
100
|
-
step 'the server returns a "502 Command not implemented" error'
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
Then /^the server returns an action not taken error$/ do
|
|
104
|
-
step 'the server returns a "550 Unable to do it" error'
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
Then /^the server returns an already exists error$/ do
|
|
108
|
-
step 'the server returns a "550 Already exists" error'
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
Then /^the server returns a network protocol not supported error$/ do
|
|
112
|
-
step 'the server returns a "522 Network protocol" error'
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
Then /^the server sends a not allowed after epsv all error$/ do
|
|
116
|
-
step 'the server returns a "501 Not allowed after EPSV ALL" error'
|
|
117
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client successfully requests features$/ do
|
|
4
|
-
@feature_reply = client.raw "FEAT"
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def feature_regexp(feature)
|
|
8
|
-
/^ #{feature}$/
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
Then /^the response should include feature "(.*?)"$/ do |feature|
|
|
12
|
-
expect(@feature_reply).to match feature_regexp(feature)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Then /^the response should not include feature "(.*?)"$/ do |feature|
|
|
16
|
-
expect(@feature_reply).to_not match feature_regexp(feature)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
Then /^the response should( not)? include TLS features$/ do |neg|
|
|
20
|
-
step %Q'the response should#{neg} include feature "AUTH TLS"'
|
|
21
|
-
step %Q'the response should#{neg} include feature "PBSZ"'
|
|
22
|
-
step %Q'the response should#{neg} include feature "PROT"'
|
|
23
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client successfully sets file structure "(.*?)"$/ do
|
|
4
|
-
|file_structure|
|
|
5
|
-
client.raw 'STRU', file_structure
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
When /^the client sets file structure "(.*?)"$/ do |file_structure|
|
|
9
|
-
capture_error do
|
|
10
|
-
step %Q'the client successfully sets file structure "#{file_structure}"'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
When /^the client sets file structure with no parameter$/ do
|
|
15
|
-
capture_error do
|
|
16
|
-
client.raw 'STRU'
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client successfully sends "(.*?)"$/ do |command|
|
|
4
|
-
@reply = client.raw command
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
When /^the client sends "(.*?)"$/ do |command|
|
|
8
|
-
capture_error do
|
|
9
|
-
step %Q'the client successfully sends "#{command}"'
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client successfully gets (text|binary) "(.*?)"$/ \
|
|
4
|
-
do |mode, remote_path|
|
|
5
|
-
client.get mode, remote_path
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
When /^the client gets (\S+) "(.*?)"$/ do |mode, path|
|
|
9
|
-
capture_error do
|
|
10
|
-
step %Q(the client successfully gets #{mode} "#{path}")
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
When /^the client gets with no path$/ do
|
|
15
|
-
capture_error do
|
|
16
|
-
client.raw 'RETR'
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
When /^the client successfully asks for help(?: for "(.*?)")?$/ do
|
|
4
|
-
|command|
|
|
5
|
-
@help_reply = client.help(command)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
Then /^the server should return a list of commands$/ do
|
|
9
|
-
commands = @help_reply.scan(/\b([A-Z][A-Z]+)\b/).flatten
|
|
10
|
-
expect(commands).to include 'NOOP'
|
|
11
|
-
expect(commands).to include 'USER'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Then /^the server should return help for "(.*?)"$/ do |command|
|
|
15
|
-
expect(@help_reply).to match /Command #{command} is recognized/
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Then /^the server should return no help for "(.*?)"$/ do |command|
|
|
19
|
-
expect(@help_reply).to match /Command #{command} is not recognized/
|
|
20
|
-
end
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class FileList
|
|
4
|
-
|
|
5
|
-
def initialize(lines)
|
|
6
|
-
@lines = lines
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def filenames
|
|
10
|
-
@lines.map(&:split).map(&:last)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def long_form?
|
|
14
|
-
@lines.all? do |line|
|
|
15
|
-
line =~ /^[rwxSst-]{10}/
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def short_form?
|
|
20
|
-
!long_form?
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def eplf_format?
|
|
24
|
-
@lines.all? do |line|
|
|
25
|
-
line =~ /^\+.*\t.*$/
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def empty?
|
|
30
|
-
@lines.empty?
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
When /^the client successfully lists the directory(?: "(.*?)")?$/ do |directory|
|
|
36
|
-
@list = FileList.new(client.ls(*[directory].compact))
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
When /^the client lists the directory( "(?:.*?)")?$/ do |directory|
|
|
40
|
-
capture_error do
|
|
41
|
-
step "the client successfully lists the directory#{directory}"
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
When /^the client successfully name-lists the directory(?: "(.*?)")?$/ do
|
|
46
|
-
|directory|
|
|
47
|
-
@list = FileList.new(client.nlst(*[directory].compact))
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
When /^the client name-lists the directory( "(?:.*?)")?$/ do |directory|
|
|
51
|
-
capture_error do
|
|
52
|
-
step "the client successfully name-lists the directory#{directory}"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
Then /^the file list should( not)? contain "(.*?)"$/ do |neg, filename|
|
|
57
|
-
verb = if neg
|
|
58
|
-
:to_not
|
|
59
|
-
else
|
|
60
|
-
:to
|
|
61
|
-
end
|
|
62
|
-
expect(@list.filenames).send(verb, include(filename))
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
Then /^the file list should be in (long|short) form$/ do |form|
|
|
66
|
-
expect(@list).to send("be_#{form}_form")
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
Then /^the file list should be empty$/ do
|
|
70
|
-
expect(@list).to be_empty
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
Then /^the list should be in EPLF format$/ do
|
|
74
|
-
expect(@list).to be_eplf_format
|
|
75
|
-
end
|