Commit 62af48a5a88c5ed391cffa97036254468ab658b8

Authored by Eric Menezes Noronha
1 parent 7afc134b
Exists in master

Teste de envio da coleta

cacic-teste/testcacic.cpp
... ... @@ -240,7 +240,7 @@ void CTestCacic::testGetTest()
240 240 bool ok;
241 241 QJsonObject envio;
242 242 envio["computador"] = OCacicComp.toJsonObject();
243   - qDebug() << envio;
  243 +// qDebug() << envio;
244 244 OCacicComm->setUrlGerente("http://teste.cacic.cc");
245 245 OCacicComm->comm("/ws/neo/getTest", &ok, envio, true);
246 246 QVERIFY(ok);
... ... @@ -248,21 +248,14 @@ void CTestCacic::testGetTest()
248 248  
249 249 void CTestCacic::testColeta()
250 250 {
251   - QJsonObject configTeste;
252   - QJsonObject configComputer;
253   - configComputer["operating_system"] = QJsonValue::fromVariant(QString(""));
254   - configComputer["user"] = QJsonValue::fromVariant(QString(""));
255   - configComputer["network_interface"] = QJsonValue::fromVariant(QString(""));
256   - configTeste["computer"] = configComputer;
257   - configTeste["hardware"] = QJsonValue::fromVariant(QString(""));
258   - configTeste["software"] = QJsonValue::fromVariant(QString(""));
259   -
260   - OCacic.setJsonToFile(configTeste,"configReq.json");
  251 + bool ok;
  252 + QJsonObject configEnvio;
  253 + configEnvio["computador"] = oColeta.getOComputer().toJsonObject();
  254 + OCacic.setJsonToFile(OCacicComm->comm("/ws/neo/config", &ok, configEnvio), "getConfig.json");
261 255 oColeta.configuraColetas();
262 256 oColeta.run();
263 257 oColeta.waitToCollect();
264   - // OCacic.setJsonToFile(oColeta.toJsonObject(), "/home/eric/coleta.json");
265   - // qDebug() << oColeta.toJsonObject();
  258 +
266 259 QVERIFY(!oColeta.toJsonObject()["software"].toObject().isEmpty() &&
267 260 !oColeta.toJsonObject()["hardware"].toObject().isEmpty());
268 261 }
... ... @@ -332,6 +325,15 @@ void CTestCacic::testFtpDownload()
332 325 QVERIFY( downloaded.readAll() != "" );
333 326 }
334 327  
  328 +void CTestCacic::testEnviaColeta()
  329 +{
  330 + bool ok;
  331 + QJsonObject coletaEnvio = oColeta.toJsonObject();
  332 +// qDebug() << coletaEnvio;
  333 + qDebug() << OCacicComm->comm("/ws/neo/coleta", &ok, coletaEnvio, true);
  334 + QVERIFY(ok);
  335 +}
  336 +
335 337 void CTestCacic::cleanupTestCase()
336 338 {
337 339 // OCacic.deleteFile("gpl-2.0.txt");
... ... @@ -345,5 +347,5 @@ void CTestCacic::cleanupTestCase()
345 347 OCacic.deleteFolder("../logs");
346 348 OCacic.deleteFile("configRequest.json");
347 349 OCacic.deleteFile("teste.json");
348   - OCacic.deleteFile("configReq.json");
  350 + OCacic.deleteFile("getConfig.json");
349 351 }
... ...
cacic-teste/testcacic.h
... ... @@ -76,6 +76,7 @@ private slots:
76 76 void testColeta();
77 77 void testLogger();
78 78 void testFtpDownload();
  79 + void testEnviaColeta();
79 80 void cleanupTestCase();
80 81 };
81 82  
... ...