@@ -499,6 +499,15 @@ def test_document
499499 "Host" => "gateway.watsonplatform.net"
500500 }
501501 ) . to_return ( status : 200 , body : { body : [ ] } . to_json , headers : { "Content-Type" => "application/json" } )
502+ service_response = service . update_document (
503+ environment_id : "envid" ,
504+ collection_id : "collid" ,
505+ document_id : "docid" ,
506+ file : "file" ,
507+ filename : "file.name"
508+ )
509+ assert_equal ( { "body" => [ ] } , service_response . body )
510+
502511 service_response = service . update_document (
503512 environment_id : "envid" ,
504513 collection_id : "collid" ,
@@ -1107,4 +1116,29 @@ def test_delete_credentials
11071116 )
11081117 assert_equal ( { "deleted" => "true" } , service_response . body )
11091118 end
1119+
1120+ def test_update_collection
1121+ service = WatsonAPIs ::DiscoveryV1 . new (
1122+ username : "username" ,
1123+ password : "password" ,
1124+ version : "2018-03-05"
1125+ )
1126+ stub_request ( :put , "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05" )
1127+ . with (
1128+ body : "{\" name\" :\" name\" ,\" description\" :\" updated description\" }" ,
1129+ headers : {
1130+ "Accept" => "application/json" ,
1131+ "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" ,
1132+ "Content-Type" => "application/json" ,
1133+ "Host" => "gateway.watsonplatform.net"
1134+ }
1135+ ) . to_return ( status : 200 , body : { "updated" => "true" } . to_json , headers : { "Content-Type" => "application/json" } )
1136+ service_response = service . update_collection (
1137+ environment_id : "envid" ,
1138+ collection_id : "collid" ,
1139+ name : "name" ,
1140+ description : "updated description"
1141+ )
1142+ assert_equal ( { "updated" => "true" } , service_response . body )
1143+ end
11101144end
0 commit comments