summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-01-14 14:49:01 -0700
committermo khan <mo.khan@gmail.com>2020-01-14 14:49:01 -0700
commit530b3f9c40f72b93866deb24fd8ea482c5098a46 (patch)
tree5354509a6e681472d2605c55f54807b01a2dfa17
parent25f7422ad1fbc39ad1464ce8080280a5006e4c6d (diff)
Add test to fetch multiple urls with a single client
-rw-r--r--test/net/client_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/net/client_test.rb b/test/net/client_test.rb
index 84fc540..9f3137f 100644
--- a/test/net/client_test.rb
+++ b/test/net/client_test.rb
@@ -18,6 +18,24 @@ class ClientTest < Minitest::Test
end
end
+ def test_multiple_gets_to_pypi
+ VCR.use_cassette('multiple-gets-to-pypi') do
+ %w{
+ https://pypi.org/pypi/django/1.11.3/json
+ https://pypi.org/pypi/Django/1.11.3/json
+ https://pypi.org/pypi/docutils/0.13.1/json
+ https://pypi.org/pypi/pytz/2019.2/json
+ https://pypi.org/pypi/requests/2.5.3/json
+ }.each do |url|
+ subject.follow_redirects = 3
+ response = subject.get(url)
+ refute_nil response
+ assert_equal Net::HTTPOK, response.class
+ assert JSON.parse(response.body)
+ end
+ end
+ end
+
def test_get_with_redirects
url = 'https://www.example.org/'
n = 10