diff options
author | 2015-08-13 16:28:21 +0300 | |
---|---|---|
committer | 2015-08-13 16:28:21 +0300 | |
commit | 7827e4de667c58517bb8ae4cfbcd7e9ae41910dc (patch) | |
tree | d6e363ae9583a38fdd9db1971050457aed656cd3 /src/gtest | |
parent | 324dea63203a5f0f53612651a32003150443ac30 (diff) |
some files added
Diffstat (limited to 'src/gtest')
-rw-r--r-- | src/gtest/rpc_test.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/gtest/rpc_test.cpp b/src/gtest/rpc_test.cpp index f80ebd5d..d8fc5389 100644 --- a/src/gtest/rpc_test.cpp +++ b/src/gtest/rpc_test.cpp @@ -75,28 +75,36 @@ TEST_F(RpcTest, basic_rpc_test) { resp_str = send_msg(req_str); EXPECT_TRUE(reader.parse(resp_str, response, false)); - EXPECT_TRUE(response["jsonrpc"] == "2.0"); - EXPECT_TRUE(response["id"] == Json::Value::null); - EXPECT_TRUE(response["error"]["code"] == -32700); + EXPECT_EQ(response["jsonrpc"], "2.0"); + EXPECT_EQ(response["id"], Json::Value::null); + EXPECT_EQ(response["error"]["code"], -32700); // check bad version req_str = "{\"jsonrpc\": \"1.5\", \"method\": \"foobar\", \"id\": \"1\"}"; resp_str = send_msg(req_str); EXPECT_TRUE(reader.parse(resp_str, response, false)); - EXPECT_TRUE(response["jsonrpc"] == "2.0"); - EXPECT_TRUE(response["id"] == "1"); - EXPECT_TRUE(response["error"]["code"] == -32600); + EXPECT_EQ(response["jsonrpc"], "2.0"); + EXPECT_EQ(response["id"], "1"); + EXPECT_EQ(response["error"]["code"], -32600); // no method name present - req_str = "{\"jsonrpc\": \"1.5\", \"id\": 482}"; + req_str = "{\"jsonrpc\": \"2.0\", \"id\": 482}"; resp_str = send_msg(req_str); EXPECT_TRUE(reader.parse(resp_str, response, false)); - EXPECT_TRUE(response["jsonrpc"] == "2.0"); - EXPECT_TRUE(response["id"] == 482); - EXPECT_TRUE(response["error"]["code"] == -32600); + EXPECT_EQ(response["jsonrpc"], "2.0"); + EXPECT_EQ(response["id"], 482); + EXPECT_EQ(response["error"]["code"], -32600); + /* method does not exist */ + req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"jfgldjlfds\", \"id\": 482}"; + resp_str = send_msg(req_str); + + EXPECT_TRUE(reader.parse(resp_str, response, false)); + EXPECT_EQ(response["jsonrpc"], "2.0"); + EXPECT_EQ(response["id"], 482); + EXPECT_EQ(response["error"]["code"], -32601); } TEST_F(RpcTest, batch_rpc_test) { |