summaryrefslogtreecommitdiff
authorJohannes Krude <johannes@krude.de>2009-01-05 21:10:27 (GMT)
committer Johannes Krude <johannes@krude.de>2009-01-05 21:10:27 (GMT)
commit445443c210f98c41860e814d43f66cb8643988df (patch)
tree662b4e6f3c2634dc414b703a2335116d3a8f526d
parent1f3f0ec2a965b0c2c8e7dd4c6766c58ee9f76ffc (diff)
downloadsendhttp-master.tar.gz
sendhttp-master.tar.bz2
added simple simple testclass for sendhttp
Diffstat
-rw-r--r--tasks/tests.rake6
-rw-r--r--test/sendhttp.rb17
2 files changed, 23 insertions, 0 deletions
diff --git a/tasks/tests.rake b/tasks/tests.rake
new file mode 100644
index 0000000..ce553ae
--- a/dev/null
+++ b/tasks/tests.rake
@@ -0,0 +1,6 @@
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.test_files = FileList['test/*.rb']
+ t.verbose = true
+end
diff --git a/test/sendhttp.rb b/test/sendhttp.rb
new file mode 100644
index 0000000..d7a6c17
--- a/dev/null
+++ b/test/sendhttp.rb
@@ -0,0 +1,17 @@
+require 'test/unit'
+
+
+require 'base64'
+
+class Test_sendhttp < Test::Unit::TestCase
+
+ def test_donwload
+ payload= Base64::b64encode((rand*100000000000000).round.to_s).strip
+ Thread.new do
+ `echo "#{payload}" | ./sendhttp -t 5 -p 12345 -q 1 - @ data`
+ end
+ sleep(1)
+ assert_equal(payload, `wget http://localhost:12345/data -O - 2> /dev/null`.strip)
+ end
+
+end