test/basic_test.rb in losant_rest-1.8.7 vs test/basic_test.rb in losant_rest-1.8.9
- old
+ new
@@ -48,9 +48,24 @@
{ value: "value2" },
])
assert_equal response, { "count" => 0, "items" => [] }
end
+ it "should correctly make calls with complex json" do
+ stub_request(:get,
+ "https://api.losant.com/applications/appId/events?_actions=false&_links=true&_embedded=true&query=%7B%22$and%22:%5B%7B%22level%22:%22info%22%7D,%7B%22state%22:%22new%22%7D%5D%7D")
+ .with(headers: { "Accept" => "application/json", "Authorization" => "Bearer my token" }).
+ to_return(body: '{ "count": 0, "items": [] }',
+ status: 200, headers: { "Content-Type" => "application/json" });
+
+ client = LosantRest::Client.new(auth_token: "my token")
+
+ response = client.events.get(applicationId: "appId", query: {
+ :"$and" => [ { level: "info" }, { state: "new" }]
+ })
+ assert_equal response, { "count" => 0, "items" => [] }
+ end
+
it "should correctly make a call with the singleton" do
stub_request(:get,
"https://api.losant.com/applications?_actions=false&_embedded=true&_links=true")
.with(headers: { "Accept" => "application/json", "Authorization" => "Bearer my token" }).
to_return(body: '{ "count": 0, "items": [] }',