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