test/yao/resources/test_restfully_accessible.rb in yao-0.13.0 vs test/yao/resources/test_restfully_accessible.rb in yao-0.13.1
- old
+ new
@@ -64,9 +64,23 @@
stub_get_request([@url, @resources_name, uuid].join('/'), @resource_name)
mock(Test).new("dummy_resource") { "OK" }
assert_equal("OK", Test.get(name))
end
+
+ test 'name (with no item JSON)' do
+ Test.return_single_on_querying = false
+ name = "dummy2"
+ uuid = "00112233-4455-6677-8899-aabbccddeeff"
+ body = {@resources_name => []}
+
+ stub_get_request_not_found([@url, @resources_name, name].join('/'))
+ stub_get_request_with_json_response([@url, "#{@resources_name}?name=#{name}"].join('/'), body)
+
+ assert_raise(Yao::InvalidResponse, "raise proper exception") do
+ Test.get(name)
+ end
+ end
end
sub_test_case 'get!' do
test 'not found' do
stub_get_request_not_found("https://example.com/dummy_resource")