summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/tc_httpfetcher.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/tc_httpfetcher.rb b/test/tc_httpfetcher.rb
index d44b3ee..e904086 100755
--- a/test/tc_httpfetcher.rb
+++ b/test/tc_httpfetcher.rb
@@ -9,7 +9,7 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_get_https
s = ''
assert_nothing_raised do
- s = HTTPFetcher::fetch('https://linuxfr.org/pub/', Time::at(0))
+ s = fetcher.fetch('https://linuxfr.org/pub/', Time::at(0))
end
assert(s.length > 20)
end
@@ -21,7 +21,7 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_get_httpnotmodif
s = 'aaa'
assert_nothing_raised do
- s = HTTPFetcher::fetch('http://www.lucas-nussbaum.net/feed2imap_tests/notmodified.php', Time::new())
+ s = fetcher.fetch('http://www.lucas-nussbaum.net/feed2imap_tests/notmodified.php', Time::new())
end
assert_nil(s)
end
@@ -29,7 +29,7 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_get_redir1
s = 'aaa'
assert_nothing_raised do
- s = HTTPFetcher::fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR}", Time::at(0))
+ s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR}", Time::at(0))
end
assert_equal('OK', s)
end
@@ -37,14 +37,14 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_get_redir2
s = ''
assert_raise(RuntimeError) do
- s = HTTPFetcher::fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR + 1}", Time::at(0))
+ s = fetcher.fetch("http://www.lucas-nussbaum.net/feed2imap_tests/redir.php?redir=#{MAXREDIR + 1}", Time::at(0))
end
end
def test_httpauth
s = ''
assert_nothing_raised do
- s = HTTPFetcher::fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php", Time::at(0))
+ s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php", Time::at(0))
end
assert_equal("Login: aaa / Password: bbb \n", s)
end
@@ -52,7 +52,7 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_redirauth
s = ''
assert_nothing_raised do
- s = HTTPFetcher::fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php?redir=1", Time::at(0))
+ s = fetcher.fetch("http://aaa:bbb@ensilinx1.imag.fr/~lucas/f2i_redirauth.php?redir=1", Time::at(0))
end
assert_equal("Login: aaa / Password: bbb \n", s)
end
@@ -60,7 +60,13 @@ class HttpFetcherTest < Test::Unit::TestCase
def test_notfound
s = ''
assert_raises(RuntimeError) do
- s = HTTPFetcher::fetch("http://ensilinx1.imag.fr/~lucas/notfound.html", Time::at(0))
+ s = fetcher.fetch("http://ensilinx1.imag.fr/~lucas/notfound.html", Time::at(0))
end
end
+
+ private
+
+ def fetcher
+ HTTPFetcher.new
+ end
end