3 class ArvadosApiClientTest < ActiveSupport::TestCase
4 # We use a mock instead of making real API calls, so there's no need to reset.
5 reset_api_fixtures :after_each_test, false
7 test 'successful stubbed api request' do
8 stub_api_calls_with_body '{"foo":"bar","baz":0}'
10 resp = ArvadosApiClient.new_or_current.api Link, ''
11 assert_equal Hash, resp.class
12 assert_equal 'bar', resp[:foo]
13 assert_equal 0, resp[:baz]
16 test 'exception if server returns non-JSON' do
17 stub_api_calls_with_invalid_json
18 assert_raises ArvadosApiClient::InvalidApiResponseException do
20 resp = ArvadosApiClient.new_or_current.api Link, ''