blob: 9da4abe66910ce85c21c8c345e9110a49306df0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require 'test_helper'
class HippieTest < Minitest::Test
def teardown
Net::Hippie.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
def test_that_it_has_a_version_number
refute_nil ::Net::Hippie::VERSION
end
def test_it_does_something_useful
assert true
end
def test_it_has_a_default_verify_mode
assert Net::Hippie.verify_mode == OpenSSL::SSL::VERIFY_PEER
end
def test_it_can_customize_the_verify_mode
Net::Hippie.verify_mode = OpenSSL::SSL::VERIFY_NONE
assert Net::Hippie.verify_mode == OpenSSL::SSL::VERIFY_NONE
end
def test_get_with_retry
uri = URI.parse('https://www.example.org/api/scim/v2/schemas')
WebMock.stub_request(:get, uri.to_s)
.to_timeout.then
.to_timeout.then
.to_timeout.then
.to_return(status: 200, body: { 'success' => 'true' }.to_json)
response = Net::Hippie.get(uri)
refute_nil response
assert_equal Net::HTTPOK, response.class
assert_equal JSON.parse(response.body)['success'], 'true'
end
end
|