Commit 62af48a5a88c5ed391cffa97036254468ab658b8
1 parent
7afc134b
Exists in
master
Teste de envio da coleta
Showing
2 changed files
with
17 additions
and
14 deletions
Show diff stats
cacic-teste/testcacic.cpp
| @@ -240,7 +240,7 @@ void CTestCacic::testGetTest() | @@ -240,7 +240,7 @@ void CTestCacic::testGetTest() | ||
| 240 | bool ok; | 240 | bool ok; |
| 241 | QJsonObject envio; | 241 | QJsonObject envio; |
| 242 | envio["computador"] = OCacicComp.toJsonObject(); | 242 | envio["computador"] = OCacicComp.toJsonObject(); |
| 243 | - qDebug() << envio; | 243 | +// qDebug() << envio; |
| 244 | OCacicComm->setUrlGerente("http://teste.cacic.cc"); | 244 | OCacicComm->setUrlGerente("http://teste.cacic.cc"); |
| 245 | OCacicComm->comm("/ws/neo/getTest", &ok, envio, true); | 245 | OCacicComm->comm("/ws/neo/getTest", &ok, envio, true); |
| 246 | QVERIFY(ok); | 246 | QVERIFY(ok); |
| @@ -248,21 +248,14 @@ void CTestCacic::testGetTest() | @@ -248,21 +248,14 @@ void CTestCacic::testGetTest() | ||
| 248 | 248 | ||
| 249 | void CTestCacic::testColeta() | 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 | oColeta.configuraColetas(); | 255 | oColeta.configuraColetas(); |
| 262 | oColeta.run(); | 256 | oColeta.run(); |
| 263 | oColeta.waitToCollect(); | 257 | oColeta.waitToCollect(); |
| 264 | - // OCacic.setJsonToFile(oColeta.toJsonObject(), "/home/eric/coleta.json"); | ||
| 265 | - // qDebug() << oColeta.toJsonObject(); | 258 | + |
| 266 | QVERIFY(!oColeta.toJsonObject()["software"].toObject().isEmpty() && | 259 | QVERIFY(!oColeta.toJsonObject()["software"].toObject().isEmpty() && |
| 267 | !oColeta.toJsonObject()["hardware"].toObject().isEmpty()); | 260 | !oColeta.toJsonObject()["hardware"].toObject().isEmpty()); |
| 268 | } | 261 | } |
| @@ -332,6 +325,15 @@ void CTestCacic::testFtpDownload() | @@ -332,6 +325,15 @@ void CTestCacic::testFtpDownload() | ||
| 332 | QVERIFY( downloaded.readAll() != "" ); | 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 | void CTestCacic::cleanupTestCase() | 337 | void CTestCacic::cleanupTestCase() |
| 336 | { | 338 | { |
| 337 | // OCacic.deleteFile("gpl-2.0.txt"); | 339 | // OCacic.deleteFile("gpl-2.0.txt"); |
| @@ -345,5 +347,5 @@ void CTestCacic::cleanupTestCase() | @@ -345,5 +347,5 @@ void CTestCacic::cleanupTestCase() | ||
| 345 | OCacic.deleteFolder("../logs"); | 347 | OCacic.deleteFolder("../logs"); |
| 346 | OCacic.deleteFile("configRequest.json"); | 348 | OCacic.deleteFile("configRequest.json"); |
| 347 | OCacic.deleteFile("teste.json"); | 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,6 +76,7 @@ private slots: | ||
| 76 | void testColeta(); | 76 | void testColeta(); |
| 77 | void testLogger(); | 77 | void testLogger(); |
| 78 | void testFtpDownload(); | 78 | void testFtpDownload(); |
| 79 | + void testEnviaColeta(); | ||
| 79 | void cleanupTestCase(); | 80 | void cleanupTestCase(); |
| 80 | }; | 81 | }; |
| 81 | 82 |