Add pending tests for binary and large files

unstable
James Lee 2012-03-17 11:04:15 -06:00
parent 78331bb4c1
commit 49217a28ec
2 changed files with 47 additions and 2 deletions

View File

@ -38,6 +38,10 @@ module ModuleTest
print_good("#{msg}") print_good("#{msg}")
end end
def pending(msg="", &block)
print_status("PENDING: #{msg}")
end
end end
module ModuleTest::PostTest module ModuleTest::PostTest

View File

@ -1,9 +1,11 @@
require 'module_test' #require 'module_test'
load 'test/lib/module_test.rb'
load 'lib/msf/core/post/file.rb' load 'lib/msf/core/post/file.rb'
class Metasploit4 < Msf::Post class Metasploit4 < Msf::Post
include Msf::ModuleTest::PostTest include Msf::ModuleTest::PostTest
include Msf::Post::Common
include Msf::Post::File include Msf::Post::File
def initialize(info={}) def initialize(info={})
@ -40,7 +42,9 @@ class Metasploit4 < Msf::Post
end end
it "should read files" do it "should read files" do
read_file("pwned") == "foo" f = read_file("pwned")
"foo" == f
end end
it "should append files" do it "should append files" do
@ -62,5 +66,42 @@ class Metasploit4 < Msf::Post
end end
def test_binary_files
binary_data = "\x00\xff\"'$"
pending "should write binary data" do
write_file("binary", binary_data)
file_exist?("binary")
end
pending "should read binary data" do
bin = read_file("binary")
bin == binary_data
end
pending "should delete binary files" do
file_rm("pwned")
not file_exist?("pwned")
end
end
def test_large_files
[ 1024, 2048, 4096, 8192, 16384, 32768, 65536 ].each { |count|
pending "should write #{count} bytes" do
bytes = "A"*count
write_file("pwned", bytes)
ret = file_exist?("pwned")
remote = read_file("pwned")
ret &&= !!(remote == bytes)
#file_rm("pwned")
ret
end
}
end
end end