JsonCommanderTest.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. #include <gmock/gmock.h>
  2. #include <gtest/gtest.h>
  3. #include "../include/JsonCommander.h"
  4. #include "FileManagerMock.h"
  5. namespace {
  6. /* Version tests */
  7. TEST(testVersion, Positive) {
  8. FileManagerMock fileManager;
  9. JsonCommander jsonCommander(fileManager);
  10. const std::string versionString = "0.2";
  11. Json::Value version;
  12. version["version"] = versionString;
  13. JsonCommander::Response response = jsonCommander.testVersion(version);
  14. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  15. EXPECT_TRUE(response.json["accept"].asBool());
  16. EXPECT_EQ(response.json["version"].asString(), versionString);
  17. }
  18. TEST(testVersion, Negative) {
  19. FileManagerMock fileManager;
  20. JsonCommander jsonCommander(fileManager);
  21. const std::string versionString = "0.1";
  22. Json::Value version;
  23. version["version"] = versionString;
  24. JsonCommander::Response response = jsonCommander.testVersion(version);
  25. EXPECT_TRUE(response.action == JsonCommander::Action::closeAndSend);
  26. EXPECT_FALSE(response.json["accept"].asBool());
  27. EXPECT_FALSE(response.json["version"].asString().compare(versionString) == 0);
  28. }
  29. /* Status tests */
  30. TEST(Status, Ok) {
  31. FileManagerMock fileManager;
  32. JsonCommander jsonCommander(fileManager);
  33. const std::string command = "status";
  34. Json::Value message;
  35. message["command"] = command;
  36. JsonCommander::Response response = jsonCommander.execute(message);
  37. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  38. EXPECT_EQ(response.json["command"].asString(), command);
  39. EXPECT_EQ(response.json["response"].asString(), "ok");
  40. }
  41. TEST(Status, Downloading) {
  42. FileManagerMock fileManager;
  43. JsonCommander jsonCommander(fileManager);
  44. const std::string command = "status";
  45. Json::Value message;
  46. message["command"] = command;
  47. ON_CALL(fileManager, isDownloading()).WillByDefault(testing::Return(true));
  48. JsonCommander::Response response = jsonCommander.execute(message);
  49. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  50. EXPECT_EQ(response.json["command"].asString(), command);
  51. EXPECT_EQ(response.json["response"].asString(), "download running");
  52. }
  53. TEST(Status, Uploading) {
  54. FileManagerMock fileManager;
  55. JsonCommander jsonCommander(fileManager);
  56. const std::string command = "status";
  57. Json::Value message;
  58. message["command"] = command;
  59. ON_CALL(fileManager, isUploading()).WillByDefault(testing::Return(true));
  60. JsonCommander::Response response = jsonCommander.execute(message);
  61. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  62. EXPECT_EQ(response.json["command"].asString(), command);
  63. EXPECT_EQ(response.json["response"].asString(), "upload running");
  64. }
  65. TEST(Status, UploadingAndDownloading) {
  66. FileManagerMock fileManager;
  67. JsonCommander jsonCommander(fileManager);
  68. const std::string command = "status";
  69. Json::Value message;
  70. message["command"] = command;
  71. ON_CALL(fileManager, isDownloading()).WillByDefault(testing::Return(true));
  72. ON_CALL(fileManager, isUploading()).WillByDefault(testing::Return(true));
  73. JsonCommander::Response response = jsonCommander.execute(message);
  74. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  75. EXPECT_EQ(response.json["command"].asString(), command);
  76. EXPECT_EQ(response.json["response"].asString(),
  77. "download and upload running");
  78. }
  79. /* Close tests */
  80. TEST(Close, Close) {
  81. FileManagerMock fileManager;
  82. JsonCommander jsonCommander(fileManager);
  83. const std::string command = "close";
  84. Json::Value message;
  85. message["command"] = command;
  86. JsonCommander::Response response = jsonCommander.execute(message);
  87. EXPECT_TRUE(response.action == JsonCommander::Action::closeAndSend);
  88. EXPECT_EQ(response.json["command"].asString(), command);
  89. EXPECT_EQ(response.json["response"].asString(), "bye");
  90. }
  91. /* Put tests */
  92. TEST(Put, Positive) {
  93. FileManagerMock fileManager;
  94. JsonCommander jsonCommander(fileManager);
  95. const std::string command = "put";
  96. const std::string filename = "cool.txt";
  97. Json::Value message;
  98. message["command"] = command;
  99. message["file"] = filename;
  100. message["size"] = 1337;
  101. ON_CALL(fileManager, openPutFile(testing::_))
  102. .WillByDefault(testing::Return(true));
  103. JsonCommander::Response response = jsonCommander.execute(message);
  104. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  105. EXPECT_EQ(response.json["command"].asString(), command);
  106. EXPECT_TRUE(response.json["accept"].asBool());
  107. EXPECT_EQ(response.json["file"].asString(), filename);
  108. EXPECT_EQ(response.json["error"].asString(), "");
  109. }
  110. TEST(Put, Negative) {
  111. FileManagerMock fileManager;
  112. JsonCommander jsonCommander(fileManager);
  113. const std::string command = "put";
  114. const std::string filename = "cool.txt";
  115. Json::Value message;
  116. message["command"] = command;
  117. message["file"] = filename;
  118. message["size"] = 1337;
  119. ON_CALL(fileManager, openPutFile(testing::_))
  120. .WillByDefault(testing::Return(false));
  121. JsonCommander::Response response = jsonCommander.execute(message);
  122. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  123. EXPECT_EQ(response.json["command"].asString(), command);
  124. EXPECT_FALSE(response.json["accept"].asBool());
  125. EXPECT_EQ(response.json["file"].asString(), filename);
  126. EXPECT_TRUE(response.json["error"].asString().length() > 0);
  127. }
  128. /* Putdata tests */
  129. TEST(Putdata, Positive) {
  130. FileManagerMock fileManager;
  131. JsonCommander jsonCommander(fileManager);
  132. /* start with put */
  133. std::string command = "put";
  134. const std::string filename = "cool.txt";
  135. Json::Value message;
  136. message["command"] = command;
  137. message["file"] = filename;
  138. message["size"] = 1337;
  139. ON_CALL(fileManager, openPutFile(testing::_))
  140. .WillByDefault(testing::Return(true));
  141. JsonCommander::Response response = jsonCommander.execute(message);
  142. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  143. EXPECT_EQ(response.json["command"].asString(), command);
  144. EXPECT_TRUE(response.json["accept"].asBool());
  145. EXPECT_EQ(response.json["file"].asString(), filename);
  146. EXPECT_EQ(response.json["error"].asString(), "");
  147. /* putdata */
  148. command = "putdata";
  149. ON_CALL(fileManager, isUploading()).WillByDefault(testing::Return(true));
  150. ON_CALL(fileManager, getPutBaseFileName())
  151. .WillByDefault(testing::Return(filename));
  152. for (int remaining = 2; remaining >= 0; remaining--) {
  153. message = Json::Value();
  154. message["command"] = command;
  155. message["file"] = filename;
  156. message["data"] = "MTMzNw==";
  157. message["remaining"] = remaining;
  158. message["cancel"] = false;
  159. response = jsonCommander.execute(message);
  160. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  161. EXPECT_EQ(response.json["command"].asString(), command);
  162. EXPECT_FALSE(response.json["cancel"].asBool());
  163. EXPECT_EQ(response.json["received"].asInt(), remaining);
  164. EXPECT_EQ(response.json["file"].asString(), filename);
  165. EXPECT_EQ(response.json["error"].asString(), "");
  166. }
  167. }
  168. TEST(Putdata, Cancel) {
  169. FileManagerMock fileManager;
  170. JsonCommander jsonCommander(fileManager);
  171. /* start with put */
  172. std::string command = "put";
  173. const std::string filename = "cool.txt";
  174. Json::Value message;
  175. message["command"] = command;
  176. message["file"] = filename;
  177. message["size"] = 1337;
  178. ON_CALL(fileManager, openPutFile(testing::_))
  179. .WillByDefault(testing::Return(true));
  180. JsonCommander::Response response = jsonCommander.execute(message);
  181. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  182. EXPECT_EQ(response.json["command"].asString(), command);
  183. EXPECT_TRUE(response.json["accept"].asBool());
  184. EXPECT_EQ(response.json["file"].asString(), filename);
  185. EXPECT_EQ(response.json["error"].asString(), "");
  186. /* putdata */
  187. command = "putdata";
  188. ON_CALL(fileManager, isUploading()).WillByDefault(testing::Return(true));
  189. ON_CALL(fileManager, getPutBaseFileName())
  190. .WillByDefault(testing::Return(filename));
  191. int remaining = 2;
  192. message = Json::Value();
  193. message["command"] = command;
  194. message["file"] = filename;
  195. message["data"] = "MTMzNw==";
  196. message["remaining"] = remaining;
  197. message["cancel"] = false;
  198. response = jsonCommander.execute(message);
  199. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  200. EXPECT_EQ(response.json["command"].asString(), command);
  201. EXPECT_FALSE(response.json["cancel"].asBool());
  202. EXPECT_EQ(response.json["received"].asInt(), remaining);
  203. EXPECT_EQ(response.json["file"].asString(), filename);
  204. EXPECT_EQ(response.json["error"].asString(), "");
  205. // cancel transfer
  206. message = Json::Value();
  207. message["command"] = command;
  208. message["file"] = filename;
  209. message["data"] = "MTMzNw==";
  210. message["remaining"] = --remaining;
  211. message["cancel"] = true;
  212. response = jsonCommander.execute(message);
  213. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  214. EXPECT_EQ(response.json["command"].asString(), command);
  215. EXPECT_TRUE(response.json["cancel"].asBool());
  216. EXPECT_EQ(response.json["received"].asInt(), remaining);
  217. EXPECT_EQ(response.json["file"].asString(), filename);
  218. EXPECT_EQ(response.json["error"].asString(), "");
  219. }
  220. TEST(Putdata, WrongRemaining) {
  221. FileManagerMock fileManager;
  222. JsonCommander jsonCommander(fileManager);
  223. /* start with put */
  224. std::string command = "put";
  225. const std::string filename = "cool.txt";
  226. Json::Value message;
  227. message["command"] = command;
  228. message["file"] = filename;
  229. message["size"] = 1337;
  230. ON_CALL(fileManager, openPutFile(testing::_))
  231. .WillByDefault(testing::Return(true));
  232. JsonCommander::Response response = jsonCommander.execute(message);
  233. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  234. EXPECT_EQ(response.json["command"].asString(), command);
  235. EXPECT_TRUE(response.json["accept"].asBool());
  236. EXPECT_EQ(response.json["file"].asString(), filename);
  237. EXPECT_EQ(response.json["error"].asString(), "");
  238. /* putdata */
  239. command = "putdata";
  240. ON_CALL(fileManager, isUploading()).WillByDefault(testing::Return(true));
  241. ON_CALL(fileManager, getPutBaseFileName())
  242. .WillByDefault(testing::Return(filename));
  243. int remaining = 2;
  244. message = Json::Value();
  245. message["command"] = command;
  246. message["file"] = filename;
  247. message["data"] = "MTMzNw==";
  248. message["remaining"] = remaining;
  249. message["cancel"] = false;
  250. response = jsonCommander.execute(message);
  251. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  252. EXPECT_EQ(response.json["command"].asString(), command);
  253. EXPECT_FALSE(response.json["cancel"].asBool());
  254. EXPECT_EQ(response.json["received"].asInt(), remaining);
  255. EXPECT_EQ(response.json["file"].asString(), filename);
  256. EXPECT_EQ(response.json["error"].asString(), "");
  257. message = Json::Value();
  258. // skip remaining=1 and provoke an error
  259. remaining = 0;
  260. message = Json::Value();
  261. message["command"] = command;
  262. message["file"] = filename;
  263. message["data"] = "MTMzNw==";
  264. message["remaining"] = remaining;
  265. message["cancel"] = false;
  266. response = jsonCommander.execute(message);
  267. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  268. EXPECT_EQ(response.json["command"].asString(), command);
  269. EXPECT_TRUE(response.json["cancel"].asBool());
  270. EXPECT_EQ(response.json["received"].asInt(), remaining);
  271. EXPECT_EQ(response.json["file"].asString(), filename);
  272. EXPECT_TRUE(response.json["error"].asString().length() > 0);
  273. }
  274. /* Get tests */
  275. TEST(Get, Positive) {
  276. FileManagerMock fileManager;
  277. JsonCommander jsonCommander(fileManager);
  278. const std::string command = "get";
  279. const std::string filename = "cool.txt";
  280. Json::Value message;
  281. message["command"] = command;
  282. message["file"] = filename;
  283. EXPECT_CALL(fileManager, openGetFile(testing::_, testing::_))
  284. .WillOnce(testing::DoAll(testing::SetArgReferee<1, int>(3),
  285. testing::Return(true)));
  286. JsonCommander::Response response = jsonCommander.execute(message);
  287. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  288. EXPECT_EQ(response.json["command"].asString(), command);
  289. EXPECT_TRUE(response.json["accept"].asBool());
  290. EXPECT_EQ(response.json["file"].asString(), filename);
  291. EXPECT_TRUE(response.json["chunks"].asInt() > 0);
  292. EXPECT_EQ(response.json["error"].asString(), "");
  293. }
  294. TEST(Get, Negative) {
  295. FileManagerMock fileManager;
  296. JsonCommander jsonCommander(fileManager);
  297. const std::string command = "get";
  298. const std::string filename = "cool.txt";
  299. Json::Value message;
  300. message["command"] = command;
  301. message["file"] = filename;
  302. EXPECT_CALL(fileManager, openGetFile(testing::_, testing::_))
  303. .WillOnce(testing::Return(false));
  304. JsonCommander::Response response = jsonCommander.execute(message);
  305. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  306. EXPECT_EQ(response.json["command"].asString(), command);
  307. EXPECT_FALSE(response.json["accept"].asBool());
  308. EXPECT_EQ(response.json["file"].asString(), filename);
  309. EXPECT_EQ(response.json["chunks"].asInt(), -1);
  310. EXPECT_TRUE(response.json["error"].asString().length() > 0);
  311. }
  312. /* Getdata tests */
  313. TEST(Getdata, Positive) {
  314. FileManagerMock fileManager;
  315. JsonCommander jsonCommander(fileManager);
  316. std::string command = "get";
  317. const std::string filename = "cool.txt";
  318. Json::Value message;
  319. message["command"] = command;
  320. message["file"] = filename;
  321. const int chunks = 3;
  322. EXPECT_CALL(fileManager, openGetFile(testing::_, testing::_))
  323. .WillOnce(testing::DoAll(testing::SetArgReferee<1, int>(chunks),
  324. testing::Return(true)));
  325. JsonCommander::Response response = jsonCommander.execute(message);
  326. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  327. EXPECT_EQ(response.json["command"].asString(), command);
  328. EXPECT_TRUE(response.json["accept"].asBool());
  329. EXPECT_EQ(response.json["file"].asString(), filename);
  330. EXPECT_EQ(response.json["chunks"].asInt(), chunks);
  331. EXPECT_EQ(response.json["error"].asString(), "");
  332. /* getdata */
  333. command = "getdata";
  334. ON_CALL(fileManager, isDownloading()).WillByDefault(testing::Return(true));
  335. ON_CALL(fileManager, getGetBaseFileName())
  336. .WillByDefault(testing::Return(filename));
  337. std::vector<char> data;
  338. data.push_back('1');
  339. data.push_back('3');
  340. data.push_back('3');
  341. data.push_back('7');
  342. ON_CALL(fileManager, readGet()).WillByDefault(testing::Return(data));
  343. for (int remaining = chunks - 1; remaining >= 0; remaining--) {
  344. message = Json::Value();
  345. message["command"] = command;
  346. message["file"] = filename;
  347. message["chunk"] = remaining;
  348. message["cancel"] = false;
  349. response = jsonCommander.execute(message);
  350. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  351. EXPECT_EQ(response.json["command"].asString(), command);
  352. EXPECT_FALSE(response.json["cancel"].asBool());
  353. EXPECT_EQ(response.json["remaining"].asInt(), remaining);
  354. EXPECT_EQ(response.json["file"].asString(), filename);
  355. EXPECT_EQ(response.json["data"].asString(), "MTMzNw==");
  356. EXPECT_EQ(response.json["error"].asString(), "");
  357. }
  358. }
  359. TEST(Getdata, Cancle) {
  360. FileManagerMock fileManager;
  361. JsonCommander jsonCommander(fileManager);
  362. std::string command = "get";
  363. const std::string filename = "cool.txt";
  364. Json::Value message;
  365. message["command"] = command;
  366. message["file"] = filename;
  367. const int chunks = 3;
  368. EXPECT_CALL(fileManager, openGetFile(testing::_, testing::_))
  369. .WillOnce(testing::DoAll(testing::SetArgReferee<1, int>(chunks),
  370. testing::Return(true)));
  371. JsonCommander::Response response = jsonCommander.execute(message);
  372. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  373. EXPECT_EQ(response.json["command"].asString(), command);
  374. EXPECT_TRUE(response.json["accept"].asBool());
  375. EXPECT_EQ(response.json["file"].asString(), filename);
  376. EXPECT_EQ(response.json["chunks"].asInt(), chunks);
  377. EXPECT_EQ(response.json["error"].asString(), "");
  378. /* getdata */
  379. command = "getdata";
  380. ON_CALL(fileManager, isDownloading()).WillByDefault(testing::Return(true));
  381. ON_CALL(fileManager, getGetBaseFileName())
  382. .WillByDefault(testing::Return(filename));
  383. std::vector<char> data;
  384. data.push_back('1');
  385. data.push_back('3');
  386. data.push_back('3');
  387. data.push_back('7');
  388. ON_CALL(fileManager, readGet()).WillByDefault(testing::Return(data));
  389. int remaining = chunks - 1;
  390. message = Json::Value();
  391. message["command"] = command;
  392. message["file"] = filename;
  393. message["chunk"] = remaining;
  394. message["cancel"] = false;
  395. response = jsonCommander.execute(message);
  396. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  397. EXPECT_EQ(response.json["command"].asString(), command);
  398. EXPECT_FALSE(response.json["cancel"].asBool());
  399. EXPECT_EQ(response.json["remaining"].asInt(), remaining);
  400. EXPECT_EQ(response.json["file"].asString(), filename);
  401. EXPECT_EQ(response.json["data"].asString(), "MTMzNw==");
  402. EXPECT_EQ(response.json["error"].asString(), "");
  403. // set cancel to true
  404. message = Json::Value();
  405. message["command"] = command;
  406. message["file"] = filename;
  407. message["chunk"] = --remaining;
  408. message["cancel"] = true;
  409. response = jsonCommander.execute(message);
  410. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  411. EXPECT_EQ(response.json["command"].asString(), command);
  412. EXPECT_TRUE(response.json["cancel"].asBool());
  413. EXPECT_EQ(response.json["remaining"].asInt(), remaining);
  414. EXPECT_EQ(response.json["file"].asString(), filename);
  415. EXPECT_EQ(response.json["data"].asString(), "");
  416. EXPECT_EQ(response.json["error"].asString(), "");
  417. }
  418. TEST(Getdata, WrongChunk) {
  419. FileManagerMock fileManager;
  420. JsonCommander jsonCommander(fileManager);
  421. std::string command = "get";
  422. const std::string filename = "cool.txt";
  423. Json::Value message;
  424. message["command"] = command;
  425. message["file"] = filename;
  426. const int chunks = 3;
  427. EXPECT_CALL(fileManager, openGetFile(testing::_, testing::_))
  428. .WillOnce(testing::DoAll(testing::SetArgReferee<1, int>(chunks),
  429. testing::Return(true)));
  430. JsonCommander::Response response = jsonCommander.execute(message);
  431. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  432. EXPECT_EQ(response.json["command"].asString(), command);
  433. EXPECT_TRUE(response.json["accept"].asBool());
  434. EXPECT_EQ(response.json["file"].asString(), filename);
  435. EXPECT_EQ(response.json["chunks"].asInt(), chunks);
  436. EXPECT_EQ(response.json["error"].asString(), "");
  437. /* getdata */
  438. command = "getdata";
  439. ON_CALL(fileManager, isDownloading()).WillByDefault(testing::Return(true));
  440. ON_CALL(fileManager, getGetBaseFileName())
  441. .WillByDefault(testing::Return(filename));
  442. std::vector<char> data;
  443. data.push_back('1');
  444. data.push_back('3');
  445. data.push_back('3');
  446. data.push_back('7');
  447. ON_CALL(fileManager, readGet()).WillByDefault(testing::Return(data));
  448. int remaining = chunks - 1;
  449. message = Json::Value();
  450. message["command"] = command;
  451. message["file"] = filename;
  452. message["chunk"] = remaining;
  453. message["cancel"] = false;
  454. response = jsonCommander.execute(message);
  455. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  456. EXPECT_EQ(response.json["command"].asString(), command);
  457. EXPECT_FALSE(response.json["cancel"].asBool());
  458. EXPECT_EQ(response.json["remaining"].asInt(), remaining);
  459. EXPECT_EQ(response.json["file"].asString(), filename);
  460. EXPECT_EQ(response.json["data"].asString(), "MTMzNw==");
  461. EXPECT_EQ(response.json["error"].asString(), "");
  462. // skip chunk=0
  463. remaining = 0;
  464. message = Json::Value();
  465. message["command"] = command;
  466. message["file"] = filename;
  467. message["chunk"] = remaining;
  468. message["cancel"] = false;
  469. response = jsonCommander.execute(message);
  470. EXPECT_TRUE(response.action == JsonCommander::Action::send);
  471. EXPECT_EQ(response.json["command"].asString(), command);
  472. EXPECT_TRUE(response.json["cancel"].asBool());
  473. EXPECT_EQ(response.json["remaining"].asInt(), remaining);
  474. EXPECT_EQ(response.json["file"].asString(), filename);
  475. EXPECT_EQ(response.json["data"].asString(), "");
  476. EXPECT_TRUE(response.json["error"].asString().length() > 0);
  477. }
  478. } // namespace