diff options
| author | mokha <mokha@cisco.com> | 2018-05-08 13:02:50 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-05-08 13:02:50 -0600 |
| commit | 6f2a4d0422ea02d7612f4fb983cccfe57fec9143 (patch) | |
| tree | 47f564add8fcba58e6e6f40804bd91fe1e3a656c /test | |
| parent | 2e2fe9498b17679ac873faf2c1617b604c3687c6 (diff) | |
add tests for Api.
Diffstat (limited to 'test')
| -rw-r--r-- | test/net/api_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/net/api_test.rb b/test/net/api_test.rb new file mode 100644 index 0000000..5c75a10 --- /dev/null +++ b/test/net/api_test.rb @@ -0,0 +1,23 @@ +require 'test_helper' + +class ApiTest < Minitest::Test + def test_get + VCR.use_cassette('get_breaches') do + subject = Net::Hippie::Api.new('https://haveibeenpwned.com/api/breaches') + response = subject.get + refute_nil response + assert_equal(283, JSON.parse(response).count) + end + end + + def test_execute + VCR.use_cassette('get_breaches') do + subject = Net::Hippie::Api.new('https://haveibeenpwned.com/api/breaches') + request = Net::HTTP::Get.new('https://haveibeenpwned.com/api/breaches') + request['Range'] = 'bytes=0-511' + response = subject.execute(request) + refute_nil response + assert_equal(283, JSON.parse(response.body).count) + end + end +end |
