summaryrefslogtreecommitdiff
path: root/test/net/ftp/test_ftp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/net/ftp/test_ftp.rb')
-rw-r--r--test/net/ftp/test_ftp.rb66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index e42168e..786f959 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -1053,6 +1053,72 @@ EOF
end
end
+ def test_size
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("213 12345\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_equal(12345, ftp.size("foo.txt"))
+ assert_match("SIZE foo.txt\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_mdtm
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("213 20150910161739\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_equal("20150910161739", ftp.mdtm("foo.txt"))
+ assert_match("MDTM foo.txt\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
+ def test_system
+ commands = []
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ commands.push(sock.gets)
+ sock.print("215 UNIX Type: L8\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_equal("UNIX Type: L8", ftp.system)
+ assert_match("SYST\r\n", commands.shift)
+ assert_equal(nil, commands.shift)
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
private