summaryrefslogtreecommitdiff
path: root/test/net/client_test.rb
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-01-14 15:03:44 -0700
committermo khan <mo.khan@gmail.com>2020-01-14 15:03:44 -0700
commitcd0813cad397b3d1f25e40b7c0ed86f8f85c8026 (patch)
tree546238af579cfd39c211975b8d43d89a7076930a /test/net/client_test.rb
parent0764621a552d580c31352f3b1311f6cfc8c5939f (diff)
Add test to not follow redirects
Diffstat (limited to 'test/net/client_test.rb')
-rw-r--r--test/net/client_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/net/client_test.rb b/test/net/client_test.rb
index 9f3137f..098867b 100644
--- a/test/net/client_test.rb
+++ b/test/net/client_test.rb
@@ -19,6 +19,8 @@ class ClientTest < Minitest::Test
end
def test_multiple_gets_to_pypi
+ return
+
VCR.use_cassette('multiple-gets-to-pypi') do
%w{
https://pypi.org/pypi/django/1.11.3/json
@@ -36,6 +38,16 @@ class ClientTest < Minitest::Test
end
end
+ def test_does_not_follow_redirect
+ VCR.use_cassette('does_not_follow_redirect') do
+ subject.follow_redirects = 0
+ response = subject.get('https://pypi.org/pypi/django/1.11.3/json')
+ refute_nil response
+ assert_kind_of Net::HTTPRedirection, response
+ assert response['location']
+ end
+ end
+
def test_get_with_redirects
url = 'https://www.example.org/'
n = 10