@@ -40,6 +40,37 @@ def test_plain_to_json
4040 assert_equal ( response , service_response . result )
4141 end
4242
43+ def test_plain_to_json_icp
44+ response = {
45+ "text" => "I want financial advice today." ,
46+ "created" => "2016-07-11T16:39:01.774Z" ,
47+ "updated" => "2015-12-07T18:53:59.153Z"
48+ }
49+ headers = {
50+ "Content-Type" => "application/json"
51+ }
52+ stub_request ( :post , "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16" )
53+ . with (
54+ body : "{\" text\" :\" I want financial advice today.\" }" ,
55+ headers : {
56+ "Accept" => "application/json" ,
57+ "Authorization" => "Basic YXBpa2V5OmljcC14eXo=" ,
58+ "Content-Type" => "application/json" ,
59+ "Host" => "gateway.watsonplatform.net"
60+ }
61+ ) . to_return ( status : 201 , body : response . to_json , headers : headers )
62+ service = IBMWatson ::AssistantV1 . new (
63+ version : "2018-02-16" ,
64+ username : "apikey" ,
65+ password : "icp-xyz"
66+ )
67+ service_response = service . create_counterexample (
68+ workspace_id : "boguswid" ,
69+ text : "I want financial advice today."
70+ )
71+ assert_equal ( response , service_response . result )
72+ end
73+
4374 def test_rate_limit_exceeded
4475 error_code = 429
4576 error_msg = "Rate limit exceeded"
0 commit comments