diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-22 00:27:02 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-22 00:27:02 +0000 |
commit | 615ac3593499f54fde4b1eb0fba66b6bd944821b (patch) | |
tree | 1f0b0e97ee3dd51798658d53cee7eec976a83a97 /test/rubygems/test_gem_remote_fetcher.rb | |
parent | ff31b35f6a66f3c1548e3356d506ff65a574be7f (diff) | |
download | ruby-615ac3593499f54fde4b1eb0fba66b6bd944821b.tar.gz |
Merge rubygems master branch from github.com/rubygems/rubygems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_remote_fetcher.rb')
-rw-r--r-- | test/rubygems/test_gem_remote_fetcher.rb | 104 |
1 files changed, 2 insertions, 102 deletions
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index dfef55c7ca..0c4367d417 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -35,7 +35,7 @@ class TestGemRemoteFetcher < Gem::TestCase include Gem::DefaultUserInteraction - SERVER_DATA = <<-EOY + SERVER_DATA = <<-EOY.freeze --- !ruby/object:Gem::Cache gems: rake-0.4.11: !ruby/object:Gem::Specification @@ -185,106 +185,6 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== end end - def test_api_endpoint - uri = URI.parse "http://example.com/foo" - target = MiniTest::Mock.new - target.expect :target, "gems.example.com" - - dns = MiniTest::Mock.new - dns.expect :getresource, target, [String, Object] - - fetch = Gem::RemoteFetcher.new nil, dns - assert_equal URI.parse("http://gems.example.com/foo"), fetch.api_endpoint(uri) - - target.verify - dns.verify - end - - def test_api_endpoint_ignores_trans_domain_values - uri = URI.parse "http://gems.example.com/foo" - target = MiniTest::Mock.new - target.expect :target, "blah.com" - - dns = MiniTest::Mock.new - dns.expect :getresource, target, [String, Object] - - fetch = Gem::RemoteFetcher.new nil, dns - assert_equal URI.parse("http://gems.example.com/foo"), fetch.api_endpoint(uri) - - target.verify - dns.verify - end - - def test_api_endpoint_ignores_trans_domain_values_that_starts_with_original - uri = URI.parse "http://example.com/foo" - target = MiniTest::Mock.new - target.expect :target, "example.combadguy.com" - - dns = MiniTest::Mock.new - dns.expect :getresource, target, [String, Object] - - fetch = Gem::RemoteFetcher.new nil, dns - assert_equal URI.parse("http://example.com/foo"), fetch.api_endpoint(uri) - - target.verify - dns.verify - end - - def test_api_endpoint_ignores_trans_domain_values_that_end_with_original - uri = URI.parse "http://example.com/foo" - target = MiniTest::Mock.new - target.expect :target, "badexample.com" - - dns = MiniTest::Mock.new - dns.expect :getresource, target, [String, Object] - - fetch = Gem::RemoteFetcher.new nil, dns - assert_equal URI.parse("http://example.com/foo"), fetch.api_endpoint(uri) - - target.verify - dns.verify - end - - def test_api_endpoint_ignores_trans_domain_values_that_end_with_original_in_path - uri = URI.parse "http://example.com/foo" - target = MiniTest::Mock.new - target.expect :target, "evil.com/a.example.com" - - dns = MiniTest::Mock.new - dns.expect :getresource, target, [String, Object] - - fetch = Gem::RemoteFetcher.new nil, dns - assert_equal URI.parse("http://example.com/foo"), fetch.api_endpoint(uri) - - target.verify - dns.verify - end - - def test_api_endpoint_timeout_warning - uri = URI.parse "http://gems.example.com/foo" - - dns = MiniTest::Mock.new - def dns.getresource arg, *rest - raise Resolv::ResolvError.new('timeout!') - end - - fetch = Gem::RemoteFetcher.new nil, dns - begin - old_verbose, Gem.configuration.verbose = Gem.configuration.verbose, 1 - endpoint = use_ui @stub_ui do - fetch.api_endpoint(uri) - end - ensure - Gem.configuration.verbose = old_verbose - end - - assert_equal uri, endpoint - - assert_equal "Getting SRV record failed: timeout!\n", @stub_ui.output - - dns.verify - end - def test_cache_update_path uri = URI 'http://example/file' path = File.join @tempdir, 'file' @@ -1064,7 +964,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg== :DocumentRoot => nil, :Logger => null_logger, :AccessLog => null_logger - ) + ) s.mount_proc("/kill") { |req, res| s.shutdown } s.mount_proc("/yaml") { |req, res| if req["X-Captain"] |