investtools-ftpd 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +5 -0
  3. data/.yardopts +7 -0
  4. data/Changelog.md +310 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +93 -0
  7. data/LICENSE.md +9 -0
  8. data/README.md +371 -0
  9. data/Rakefile +14 -0
  10. data/VERSION +1 -0
  11. data/doc/benchmarks.md +82 -0
  12. data/doc/references.md +66 -0
  13. data/doc/rfc-compliance.md +292 -0
  14. data/examples/example.rb +275 -0
  15. data/examples/example_spec.rb +93 -0
  16. data/examples/hello_world.rb +32 -0
  17. data/features/example/eplf.feature +14 -0
  18. data/features/example/example.feature +18 -0
  19. data/features/example/read_only.feature +63 -0
  20. data/features/example/step_definitions/example_server.rb +11 -0
  21. data/features/ftp_server/abort.feature +13 -0
  22. data/features/ftp_server/allo.feature +33 -0
  23. data/features/ftp_server/append.feature +94 -0
  24. data/features/ftp_server/cdup.feature +36 -0
  25. data/features/ftp_server/command_errors.feature +13 -0
  26. data/features/ftp_server/concurrent_sessions.feature +14 -0
  27. data/features/ftp_server/delay_after_failed_login.feature +23 -0
  28. data/features/ftp_server/delete.feature +60 -0
  29. data/features/ftp_server/directory_navigation.feature +59 -0
  30. data/features/ftp_server/disconnect_after_failed_logins.feature +25 -0
  31. data/features/ftp_server/eprt.feature +55 -0
  32. data/features/ftp_server/epsv.feature +36 -0
  33. data/features/ftp_server/features.feature +38 -0
  34. data/features/ftp_server/file_structure.feature +43 -0
  35. data/features/ftp_server/get.feature +80 -0
  36. data/features/ftp_server/get_ipv6.feature +43 -0
  37. data/features/ftp_server/get_tls.feature +23 -0
  38. data/features/ftp_server/help.feature +21 -0
  39. data/features/ftp_server/implicit_tls.feature +23 -0
  40. data/features/ftp_server/invertability.feature +15 -0
  41. data/features/ftp_server/list.feature +94 -0
  42. data/features/ftp_server/list_tls.feature +29 -0
  43. data/features/ftp_server/logging.feature +11 -0
  44. data/features/ftp_server/login_auth_level_account.feature +51 -0
  45. data/features/ftp_server/login_auth_level_password.feature +59 -0
  46. data/features/ftp_server/login_auth_level_user.feature +31 -0
  47. data/features/ftp_server/max_connections.feature +39 -0
  48. data/features/ftp_server/mdtm.feature +53 -0
  49. data/features/ftp_server/mkdir.feature +70 -0
  50. data/features/ftp_server/mode.feature +43 -0
  51. data/features/ftp_server/name_list.feature +77 -0
  52. data/features/ftp_server/name_list_tls.feature +30 -0
  53. data/features/ftp_server/noop.feature +17 -0
  54. data/features/ftp_server/options.feature +17 -0
  55. data/features/ftp_server/pasv.feature +23 -0
  56. data/features/ftp_server/port.feature +49 -0
  57. data/features/ftp_server/put.feature +79 -0
  58. data/features/ftp_server/put_tls.feature +23 -0
  59. data/features/ftp_server/put_unique.feature +56 -0
  60. data/features/ftp_server/quit.feature +23 -0
  61. data/features/ftp_server/reinitialize.feature +13 -0
  62. data/features/ftp_server/rename.feature +97 -0
  63. data/features/ftp_server/rmdir.feature +71 -0
  64. data/features/ftp_server/site.feature +13 -0
  65. data/features/ftp_server/size.feature +69 -0
  66. data/features/ftp_server/status.feature +18 -0
  67. data/features/ftp_server/step_definitions/logging.rb +8 -0
  68. data/features/ftp_server/step_definitions/test_server.rb +65 -0
  69. data/features/ftp_server/structure_mount.feature +13 -0
  70. data/features/ftp_server/syntax_errors.feature +18 -0
  71. data/features/ftp_server/syst.feature +18 -0
  72. data/features/ftp_server/timeout.feature +26 -0
  73. data/features/ftp_server/type.feature +59 -0
  74. data/features/step_definitions/append.rb +15 -0
  75. data/features/step_definitions/client.rb +24 -0
  76. data/features/step_definitions/client_and_server_files.rb +24 -0
  77. data/features/step_definitions/client_files.rb +14 -0
  78. data/features/step_definitions/command.rb +5 -0
  79. data/features/step_definitions/connect.rb +37 -0
  80. data/features/step_definitions/delete.rb +15 -0
  81. data/features/step_definitions/directory_navigation.rb +26 -0
  82. data/features/step_definitions/error_replies.rb +115 -0
  83. data/features/step_definitions/features.rb +21 -0
  84. data/features/step_definitions/file_structure.rb +16 -0
  85. data/features/step_definitions/generic_send.rb +9 -0
  86. data/features/step_definitions/get.rb +16 -0
  87. data/features/step_definitions/help.rb +18 -0
  88. data/features/step_definitions/invalid_commands.rb +11 -0
  89. data/features/step_definitions/line_endings.rb +7 -0
  90. data/features/step_definitions/list.rb +73 -0
  91. data/features/step_definitions/login.rb +82 -0
  92. data/features/step_definitions/mkdir.rb +9 -0
  93. data/features/step_definitions/mode.rb +15 -0
  94. data/features/step_definitions/mtime.rb +23 -0
  95. data/features/step_definitions/noop.rb +15 -0
  96. data/features/step_definitions/options.rb +9 -0
  97. data/features/step_definitions/passive.rb +3 -0
  98. data/features/step_definitions/pending.rb +3 -0
  99. data/features/step_definitions/port.rb +5 -0
  100. data/features/step_definitions/put.rb +29 -0
  101. data/features/step_definitions/quit.rb +15 -0
  102. data/features/step_definitions/rename.rb +11 -0
  103. data/features/step_definitions/rmdir.rb +9 -0
  104. data/features/step_definitions/server_files.rb +61 -0
  105. data/features/step_definitions/server_title.rb +12 -0
  106. data/features/step_definitions/size.rb +20 -0
  107. data/features/step_definitions/status.rb +9 -0
  108. data/features/step_definitions/success_replies.rb +7 -0
  109. data/features/step_definitions/system.rb +7 -0
  110. data/features/step_definitions/timing.rb +19 -0
  111. data/features/step_definitions/type.rb +15 -0
  112. data/features/support/env.rb +4 -0
  113. data/features/support/example_server.rb +67 -0
  114. data/features/support/file_templates/ascii_unix +4 -0
  115. data/features/support/file_templates/ascii_windows +4 -0
  116. data/features/support/file_templates/binary +0 -0
  117. data/features/support/test_client.rb +250 -0
  118. data/features/support/test_file_templates.rb +33 -0
  119. data/features/support/test_server.rb +293 -0
  120. data/features/support/test_server_files.rb +57 -0
  121. data/ftpd.gemspec +283 -0
  122. data/insecure-test-cert.pem +29 -0
  123. data/investtools-ftpd.gemspec +284 -0
  124. data/lib/ftpd.rb +86 -0
  125. data/lib/ftpd/auth_levels.rb +9 -0
  126. data/lib/ftpd/cmd_abor.rb +13 -0
  127. data/lib/ftpd/cmd_allo.rb +20 -0
  128. data/lib/ftpd/cmd_appe.rb +24 -0
  129. data/lib/ftpd/cmd_auth.rb +21 -0
  130. data/lib/ftpd/cmd_cdup.rb +16 -0
  131. data/lib/ftpd/cmd_cwd.rb +20 -0
  132. data/lib/ftpd/cmd_dele.rb +21 -0
  133. data/lib/ftpd/cmd_eprt.rb +23 -0
  134. data/lib/ftpd/cmd_epsv.rb +30 -0
  135. data/lib/ftpd/cmd_feat.rb +44 -0
  136. data/lib/ftpd/cmd_help.rb +29 -0
  137. data/lib/ftpd/cmd_list.rb +33 -0
  138. data/lib/ftpd/cmd_login.rb +60 -0
  139. data/lib/ftpd/cmd_mdtm.rb +27 -0
  140. data/lib/ftpd/cmd_mkd.rb +23 -0
  141. data/lib/ftpd/cmd_mode.rb +27 -0
  142. data/lib/ftpd/cmd_nlst.rb +27 -0
  143. data/lib/ftpd/cmd_noop.rb +14 -0
  144. data/lib/ftpd/cmd_opts.rb +14 -0
  145. data/lib/ftpd/cmd_pasv.rb +28 -0
  146. data/lib/ftpd/cmd_pbsz.rb +23 -0
  147. data/lib/ftpd/cmd_port.rb +28 -0
  148. data/lib/ftpd/cmd_prot.rb +34 -0
  149. data/lib/ftpd/cmd_pwd.rb +15 -0
  150. data/lib/ftpd/cmd_quit.rb +18 -0
  151. data/lib/ftpd/cmd_rein.rb +13 -0
  152. data/lib/ftpd/cmd_rename.rb +32 -0
  153. data/lib/ftpd/cmd_rest.rb +13 -0
  154. data/lib/ftpd/cmd_retr.rb +24 -0
  155. data/lib/ftpd/cmd_rmd.rb +22 -0
  156. data/lib/ftpd/cmd_site.rb +13 -0
  157. data/lib/ftpd/cmd_size.rb +29 -0
  158. data/lib/ftpd/cmd_smnt.rb +13 -0
  159. data/lib/ftpd/cmd_stat.rb +15 -0
  160. data/lib/ftpd/cmd_stor.rb +25 -0
  161. data/lib/ftpd/cmd_stou.rb +25 -0
  162. data/lib/ftpd/cmd_stru.rb +27 -0
  163. data/lib/ftpd/cmd_syst.rb +16 -0
  164. data/lib/ftpd/cmd_type.rb +28 -0
  165. data/lib/ftpd/command_handler.rb +90 -0
  166. data/lib/ftpd/command_handler_factory.rb +51 -0
  167. data/lib/ftpd/command_handlers.rb +60 -0
  168. data/lib/ftpd/command_loop.rb +80 -0
  169. data/lib/ftpd/command_sequence_checker.rb +58 -0
  170. data/lib/ftpd/config.rb +13 -0
  171. data/lib/ftpd/connection_throttle.rb +56 -0
  172. data/lib/ftpd/connection_tracker.rb +82 -0
  173. data/lib/ftpd/data_connection_helper.rb +123 -0
  174. data/lib/ftpd/disk_file_system.rb +434 -0
  175. data/lib/ftpd/error.rb +21 -0
  176. data/lib/ftpd/exception_translator.rb +32 -0
  177. data/lib/ftpd/exceptions.rb +62 -0
  178. data/lib/ftpd/file_info.rb +115 -0
  179. data/lib/ftpd/file_system_helper.rb +67 -0
  180. data/lib/ftpd/ftp_server.rb +214 -0
  181. data/lib/ftpd/gets_peer_address.rb +41 -0
  182. data/lib/ftpd/insecure_certificate.rb +16 -0
  183. data/lib/ftpd/list_format/eplf.rb +74 -0
  184. data/lib/ftpd/list_format/ls.rb +154 -0
  185. data/lib/ftpd/list_path.rb +28 -0
  186. data/lib/ftpd/null_logger.rb +22 -0
  187. data/lib/ftpd/protocols.rb +60 -0
  188. data/lib/ftpd/read_only_disk_file_system.rb +22 -0
  189. data/lib/ftpd/server.rb +139 -0
  190. data/lib/ftpd/session.rb +220 -0
  191. data/lib/ftpd/session_config.rb +111 -0
  192. data/lib/ftpd/stream.rb +80 -0
  193. data/lib/ftpd/telnet.rb +114 -0
  194. data/lib/ftpd/temp_dir.rb +22 -0
  195. data/lib/ftpd/tls_server.rb +111 -0
  196. data/lib/ftpd/translate_exceptions.rb +68 -0
  197. data/rake_tasks/cucumber.rake +9 -0
  198. data/rake_tasks/default.rake +1 -0
  199. data/rake_tasks/jeweler.rake +52 -0
  200. data/rake_tasks/spec.rake +3 -0
  201. data/rake_tasks/test.rake +2 -0
  202. data/rake_tasks/yard.rake +3 -0
  203. data/spec/command_sequence_checker_spec.rb +83 -0
  204. data/spec/connection_throttle_spec.rb +99 -0
  205. data/spec/connection_tracker_spec.rb +97 -0
  206. data/spec/disk_file_system_spec.rb +320 -0
  207. data/spec/exception_translator_spec.rb +36 -0
  208. data/spec/file_info_spec.rb +59 -0
  209. data/spec/ftp_server_error_spec.rb +13 -0
  210. data/spec/list_format/eplf_spec.rb +61 -0
  211. data/spec/list_format/ls_spec.rb +270 -0
  212. data/spec/list_path_spec.rb +21 -0
  213. data/spec/null_logger_spec.rb +24 -0
  214. data/spec/protocols_spec.rb +139 -0
  215. data/spec/server_spec.rb +81 -0
  216. data/spec/spec_helper.rb +15 -0
  217. data/spec/telnet_spec.rb +75 -0
  218. data/spec/translate_exceptions_spec.rb +40 -0
  219. metadata +404 -0
@@ -0,0 +1,93 @@
1
+ # encoding: utf-8
2
+
3
+ # Authour: Michael de Silva <michael@mwdesilva.com>
4
+ # CEO @ http://omakaselabs.com / Mentor @ http://railsphd.com
5
+ # https://twitter.com/bsodmike / https://github.com/bsodmike
6
+
7
+ # This is an example for using Ftpd as a means for spec driving
8
+ # interaction with a 'dummy' ftp server via RSpec. In this example we
9
+ # assume the client is implemented via `Fetcher::FTPFetcher`.
10
+
11
+ unless $:.include?(File.dirname(__FILE__) + '/../lib')
12
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
13
+ end
14
+
15
+ require 'net/ftp'
16
+ require 'ftpd'
17
+ require 'tmpdir'
18
+
19
+ # This is an example client spec driven via the use of Ftpd within the
20
+ # specs. The specs spawn a 'dummy' Ftpd server and ensure this client
21
+ # operates as expected.
22
+
23
+ module Fetcher
24
+
25
+ # This is the code under test, a simple fetcher that logs into an
26
+ # FTP site, changes to a directory, and gets a list of files.
27
+
28
+ class FTPFetcher
29
+
30
+ # @param host [String] ftp host to connect to.
31
+ # @param user [String] username.
32
+ # @param pwd [String] password.
33
+ # @param dir [String] remote directory to change to.
34
+
35
+ def initialize(host, user, pwd, dir)
36
+ @host = host
37
+ @user = user
38
+ @pwd = pwd
39
+ @dir = dir
40
+ @ftp = Net::FTP.new
41
+ end
42
+
43
+ # @param port [Fixnum] port to connect to, 21 by default.
44
+ # @return [Array] list of files in the current directory.
45
+
46
+ def connect_and_list(port = 21)
47
+ @ftp.debug_mode = true if ENV['DEBUG'] == "true"
48
+ @ftp.passive = true
49
+ @ftp.connect @host, port
50
+ @ftp.login @user, @pwd
51
+ @ftp.chdir @dir
52
+ @ftp.nlst
53
+ end
54
+
55
+ end
56
+ end
57
+
58
+ describe Fetcher::FTPFetcher do
59
+
60
+ # This `Driver` tells Ftpd how to authenticate and how to interact
61
+ # with the file system. In this example, the file system is
62
+ # read-only and contains a single file.
63
+
64
+ class Driver
65
+ def initialize
66
+ @data_dir = Dir.mktmpdir
67
+ at_exit {FileUtils.rm_rf(@data_dir)}
68
+ FileUtils.touch File.expand_path('report.txt', @data_dir)
69
+ end
70
+ def authenticate(user, pwd); true; end
71
+ def file_system(user); Ftpd::ReadOnlyDiskFileSystem.new(@data_dir); end
72
+ end
73
+
74
+ let(:server) do
75
+ server = Ftpd::FtpServer.new(Driver.new)
76
+ server.interface = "127.0.0.1"
77
+ server.start
78
+ server
79
+ end
80
+
81
+ let(:subject) do
82
+ Fetcher::FTPFetcher.new('127.0.0.1', 'user', 'password', '/')
83
+ end
84
+
85
+ describe "#connect_and_list" do
86
+
87
+ it "should connect to the FTP server and find 'report.txt' in the Array returned" do
88
+ result = subject.connect_and_list(server.bound_port)
89
+ expect(result).to include('report.txt')
90
+ end
91
+
92
+ end
93
+ end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ unless $:.include?(File.dirname(__FILE__) + '/../lib')
4
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
5
+ end
6
+
7
+ require 'ftpd'
8
+ require 'tmpdir'
9
+
10
+ class Driver
11
+
12
+ def initialize(temp_dir)
13
+ @temp_dir = temp_dir
14
+ end
15
+
16
+ def authenticate(user, password)
17
+ true
18
+ end
19
+
20
+ def file_system(user)
21
+ Ftpd::DiskFileSystem.new(@temp_dir)
22
+ end
23
+
24
+ end
25
+
26
+ Dir.mktmpdir do |temp_dir|
27
+ driver = Driver.new(temp_dir)
28
+ server = Ftpd::FtpServer.new(driver)
29
+ server.start
30
+ puts "Server listening on port #{server.bound_port}"
31
+ gets
32
+ end
@@ -0,0 +1,14 @@
1
+ Feature: Example
2
+
3
+ As a programmer
4
+ I want to enable EPLF list format
5
+ So that I can test this library with an EPLF client
6
+
7
+ Background:
8
+ Given the example has argument "--eplf"
9
+ And the example server is started
10
+
11
+ Scenario: List directory
12
+ Given a successful login
13
+ When the client successfully lists the directory
14
+ Then the list should be in EPLF format
@@ -0,0 +1,18 @@
1
+ Feature: Example
2
+
3
+ As a programmer
4
+ I want to connect to the example
5
+ So that I can try this libary with an arbitrary FTP client
6
+
7
+ Background:
8
+ Given the example server is started
9
+
10
+ Scenario: Normal connection
11
+ Given a successful login
12
+ Then the server returns no error
13
+ And the client should be logged in
14
+
15
+ Scenario: Fetch README
16
+ Given a successful login
17
+ When the client successfully gets text "README"
18
+ Then the local file "README" should match the remote file
@@ -0,0 +1,63 @@
1
+ Feature: Example
2
+
3
+ As a programmer
4
+ I want to start a read-only server
5
+ So that nobody can modify the file system I expose
6
+
7
+ Background:
8
+ Given the example has argument "--read-only"
9
+ And the example server is started
10
+
11
+ Scenario: Fetch README
12
+ Given a successful login
13
+ When the client successfully gets text "README"
14
+ Then the local file "README" should match the remote file
15
+
16
+ Scenario: Fetch README
17
+ Given a successful login
18
+ When the client successfully gets text "README"
19
+ Then the local file "README" should match the remote file
20
+
21
+ Scenario: List
22
+ Given a successful login
23
+ When the client successfully lists the directory
24
+ Then the file list should be in long form
25
+ And the file list should contain "README"
26
+
27
+ Scenario: Name List
28
+ Given a successful login
29
+ When the client successfully name-lists the directory
30
+ Then the file list should be in short form
31
+ And the file list should contain "README"
32
+
33
+ Scenario: Put
34
+ Given a successful login
35
+ And the client has file "foo"
36
+ When the client puts text "foo"
37
+ Then the server returns an unimplemented command error
38
+
39
+ Scenario: Put unique
40
+ Given a successful login
41
+ And the client has file "foo"
42
+ When the client stores unique "foo"
43
+ Then the server returns an unimplemented command error
44
+
45
+ Scenario: Delete
46
+ Given a successful login
47
+ When the client deletes "README"
48
+ Then the server returns an unimplemented command error
49
+
50
+ Scenario: Mkdir
51
+ Given a successful login
52
+ When the client makes directory "foo"
53
+ Then the server returns an unimplemented command error
54
+
55
+ Scenario: Rename
56
+ Given a successful login
57
+ When the client renames "README" to "foo"
58
+ Then the server returns an unimplemented command error
59
+
60
+ Scenario: Rmdir
61
+ Given a successful login
62
+ When the client removes directory "foo"
63
+ Then the server returns an unimplemented command error
@@ -0,0 +1,11 @@
1
+ def example_args
2
+ @example_args ||= []
3
+ end
4
+
5
+ Given /^the example has argument "(.*?)"$/ do |arg|
6
+ example_args << arg
7
+ end
8
+
9
+ Given /^the example server is started$/ do
10
+ @server = ExampleServer.new(example_args)
11
+ end
@@ -0,0 +1,13 @@
1
+ Feature: Abort
2
+
3
+ As a client
4
+ I want to know this command is not supported
5
+ So that I can avoid using it
6
+
7
+ Background:
8
+ Given the test server is started
9
+
10
+ Scenario: Unimplemented
11
+ Given a successful connection
12
+ When the client sends command "ABOR"
13
+ Then the server returns an unimplemented command error
@@ -0,0 +1,33 @@
1
+ Feature: ALLO
2
+
3
+ As a client
4
+ I want to reserve file system space
5
+ So that my put will succeed
6
+
7
+ Background:
8
+ Given the test server is started
9
+
10
+ Scenario: With count
11
+ Given a successful login
12
+ When the client successfully sends "ALLO 1024"
13
+ Then the server returns a not necessary reply
14
+
15
+ Scenario: With count and record size
16
+ Given a successful login
17
+ When the client successfully sends "ALLO 1024 R 128"
18
+ Then the server returns a not necessary reply
19
+
20
+ Scenario: Not logged in
21
+ Given a successful connection
22
+ When the client sends "ALLO 1024"
23
+ Then the server returns a not logged in error
24
+
25
+ Scenario: Missing argument
26
+ Given a successful login
27
+ When the client sends "ALLO"
28
+ Then the server returns a syntax error
29
+
30
+ Scenario: Invalid argument
31
+ Given a successful login
32
+ When the client sends "ALLO XYZ"
33
+ Then the server returns a syntax error
@@ -0,0 +1,94 @@
1
+ Feature: Append
2
+
3
+ As a client
4
+ I want to append to a file
5
+ Because it is a log
6
+
7
+ Background:
8
+ Given the test server is started
9
+
10
+ Scenario: ASCII file with *nix line endings
11
+ Given a successful login
12
+ And the server has file "foo"
13
+ And the client has file "ascii_unix"
14
+ When the client successfully appends text "ascii_unix" onto "foo"
15
+ Then the remote file "foo" should match "foo" + "ascii_unix"
16
+
17
+ Scenario: ASCII file with windows line endings
18
+ Given a successful login
19
+ And the server has file "foo"
20
+ And the client has file "ascii_windows"
21
+ When the client successfully appends text "ascii_windows" onto "foo"
22
+ Then the remote file "foo" should match "foo" + "ascii_unix"
23
+
24
+ Scenario: Binary file
25
+ Given a successful login
26
+ And the server has file "foo"
27
+ And the client has file "binary"
28
+ When the client successfully appends binary "binary" onto "foo"
29
+ Then the remote file "foo" should match "foo" + "binary"
30
+
31
+ Scenario: Passive
32
+ Given a successful login
33
+ And the server has file "foo"
34
+ And the client has file "binary"
35
+ And the client is in passive mode
36
+ When the client successfully appends binary "binary" onto "foo"
37
+ Then the remote file "foo" should match "foo" + "binary"
38
+
39
+ Scenario: Destination missing
40
+ Given a successful login
41
+ And the client has file "binary"
42
+ When the client successfully appends binary "binary" onto "foo"
43
+ Then the remote file "foo" should match "binary"
44
+
45
+ Scenario: Subdir
46
+ Given a successful login
47
+ And the server has file "subdir/foo"
48
+ And the client has file "binary"
49
+ When the client successfully appends binary "binary" onto "subdir/foo"
50
+ Then the remote file "subdir/foo" should match "foo" + "binary"
51
+
52
+ Scenario: Non-root working directory
53
+ Given a successful login
54
+ And the server has file "subdir/foo"
55
+ And the client has file "binary"
56
+ And the client successfully cd's to "subdir"
57
+ When the client successfully appends binary "binary" onto "foo"
58
+ Then the remote file "subdir/foo" should match "foo" + "binary"
59
+
60
+ Scenario: Access denied
61
+ Given a successful login
62
+ And the client has file "foo"
63
+ When the client appends binary "foo" onto "forbidden"
64
+ Then the server returns an access denied error
65
+
66
+ Scenario: Missing directory
67
+ Given a successful login
68
+ And the client has file "binary"
69
+ When the client appends binary "binary" onto "subdir/foo"
70
+ Then the server returns a not found error
71
+
72
+ Scenario: Not logged in
73
+ Given a successful connection
74
+ And the client has file "foo"
75
+ When the client appends binary "foo" onto "foo"
76
+ Then the server returns a not logged in error
77
+
78
+ Scenario: Missing path
79
+ Given a successful login
80
+ When the client sends "APPE"
81
+ Then the server returns a syntax error
82
+
83
+ Scenario: File system error
84
+ Given a successful login
85
+ And the client has file "foo"
86
+ When the client appends text "foo" onto "unable"
87
+ Then the server returns an action not taken error
88
+
89
+ Scenario: Append not enabled
90
+ Given the test server lacks append
91
+ And a successful login
92
+ And the client has file "foo"
93
+ When the client appends text "foo" onto "bar"
94
+ Then the server returns an unimplemented command error
@@ -0,0 +1,36 @@
1
+ Feature: Change Directory
2
+
3
+ As a client
4
+ I want to change to the parent directory
5
+
6
+ Background:
7
+ Given the test server is started
8
+
9
+ Scenario: From subdir
10
+ Given a successful login
11
+ And the server has directory "subdir"
12
+ And the client successfully cd's to "subdir"
13
+ When the client successfully cd's up
14
+ Then the current directory should be "/"
15
+
16
+ Scenario: From root
17
+ Given a successful login
18
+ When the client successfully cd's up
19
+ Then the current directory should be "/"
20
+
21
+ Scenario: XCUP
22
+ Given a successful login
23
+ And the server has directory "subdir"
24
+ And the client successfully cd's to "subdir"
25
+ When the client successfully sends "XCUP"
26
+ Then the current directory should be "/"
27
+
28
+ Scenario: With argument
29
+ Given a successful login
30
+ When the client sends "CDUP abc"
31
+ Then the server returns a syntax error
32
+
33
+ Scenario: Not logged in
34
+ Given a successful connection
35
+ When the client cd's to "subdir"
36
+ Then the server returns a not logged in error
@@ -0,0 +1,13 @@
1
+ Feature: Command Errors
2
+
3
+ As a client
4
+ I want good error messages
5
+ So that I can figure out what went wrong
6
+
7
+ Background:
8
+ Given the test server is started
9
+
10
+ Scenario: Unknown command
11
+ Given a successful connection
12
+ When the client sends command "foo"
13
+ Then the server returns a command unrecognized error
@@ -0,0 +1,14 @@
1
+ Feature: Concurrent Sessions
2
+
3
+ As a client
4
+ I want to start a session when there is another session
5
+ So that my session doesn't have to wait on the other
6
+
7
+ Background:
8
+ Given the test server is started
9
+
10
+ Scenario: Stream
11
+ Given a successful login
12
+ And the server has file "ascii_unix"
13
+ And the second client connects and logs in
14
+ Then the second client successfully does nothing