Build test application for Konachan API
This commit is contained in:
parent
7caa2d6956
commit
c5b8fccc6f
4 changed files with 114 additions and 18 deletions
|
@ -3,11 +3,56 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
void runKonachanTest();
|
||||
void runYandeReTest();
|
||||
void runDanbooruTest();
|
||||
|
||||
Danbooru::KonachanServiceTest* testSvc = 0;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
qDebug() << "Starting Konachan API test";
|
||||
Danbooru::KonachanServiceTest* testSvc = new Danbooru::KonachanServiceTest();
|
||||
QTimer::singleShot(2000, testSvc, &Danbooru::KonachanServiceTest::testPostService);
|
||||
|
||||
QCommandLineParser cmdParser;
|
||||
cmdParser.addHelpOption();
|
||||
cmdParser.addVersionOption();
|
||||
|
||||
QCommandLineOption testKonachan("test-konachan", "Run Konachan.com tests");
|
||||
QCommandLineOption testYandeRe("test-yandere", "Run yande.re tests");
|
||||
|
||||
cmdParser.addOptions({testKonachan, testYandeRe});
|
||||
|
||||
// cmdParser.addOption(testKonachan);
|
||||
// cmdParser.addOption(testYandeRe);
|
||||
|
||||
cmdParser.process(app);
|
||||
|
||||
if (cmdParser.isSet(testKonachan)) {
|
||||
runKonachanTest();
|
||||
} else if (cmdParser.isSet(testYandeRe)) {
|
||||
runYandeReTest();
|
||||
}
|
||||
|
||||
app.exec();
|
||||
}
|
||||
|
||||
void runKonachanTest()
|
||||
{
|
||||
qDebug() << "Starting Konachan API test";
|
||||
qDebug() << "------ POST TEST ----";
|
||||
testSvc = new Danbooru::KonachanServiceTest(QUrl("http://konachan.com"));
|
||||
testSvc->testPostService();
|
||||
qDebug() << "--- POOL TEST ---";
|
||||
testSvc->testPoolService();
|
||||
}
|
||||
|
||||
void runYandeReTest()
|
||||
{
|
||||
qDebug() << "Starting yande.re API test";
|
||||
testSvc = new Danbooru::KonachanServiceTest(QUrl("http://yande.re"));
|
||||
qDebug() << "------ POST TEST ----";
|
||||
testSvc->testPostService();
|
||||
qDebug() << "--- POOL TEST ---";
|
||||
testSvc->testPoolService();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue