forked from ondra/server-sdk
updated unitests
This commit is contained in:
parent
ea0258cef1
commit
aeb98c0f06
@ -28,8 +28,8 @@ QNetworkRequest Request::networkRequest() const
|
||||
request.setRawHeader("Accept-Encoding", "gzip, deflate");
|
||||
#endif
|
||||
|
||||
// Enabling HTTP/2 ( not supported on Ubuntu 16.04 )
|
||||
// request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
|
||||
// Enabling HTTP/2 ( does not work on Qt 5.9.8 )
|
||||
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
@ -24,8 +24,6 @@ public:
|
||||
QString url() const;
|
||||
void setUrl(const QString &url);
|
||||
|
||||
|
||||
|
||||
// Authorization
|
||||
QString userName() const;
|
||||
void setUserName(const QString &userName);
|
||||
|
||||
@ -12,7 +12,7 @@ SoapRequest::SoapRequest(QString action, QString endpoint, QByteArray data)
|
||||
QNetworkRequest SoapRequest::networkRequest() const
|
||||
{
|
||||
Q_ASSERT(!this->url().isEmpty());
|
||||
QNetworkRequest request(QUrl(this->url()));
|
||||
QNetworkRequest request = Request::networkRequest();
|
||||
|
||||
// Have to set header
|
||||
QString header;
|
||||
@ -33,7 +33,7 @@ QNetworkRequest SoapRequest::networkRequest() const
|
||||
request.setRawHeader("Accept-Encoding", "gzip, deflate");
|
||||
|
||||
// Enabling HTTP/2 ( not supported on Ubuntu 16.04 )
|
||||
// request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
|
||||
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
basic \
|
||||
soap \
|
||||
unittests \
|
||||
request \
|
||||
utils
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
QT += testlib
|
||||
QT -= gui
|
||||
|
||||
CONFIG += qt console warn_on depend_includepath testcase
|
||||
CONFIG -= app_bundle
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += tst_basictest.cpp
|
||||
|
||||
include(../../../serversdkint.pri)
|
||||
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Filip Bucek - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Filip Bucek <fbucek@invloop.cz>, 2019
|
||||
*/
|
||||
#include <QtTest>
|
||||
|
||||
// add necessary includes here
|
||||
|
||||
class basicTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
basicTest();
|
||||
~basicTest();
|
||||
|
||||
private slots:
|
||||
void test_case1();
|
||||
|
||||
};
|
||||
|
||||
basicTest::basicTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
basicTest::~basicTest()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void basicTest::test_case1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(basicTest)
|
||||
|
||||
#include "tst_basictest.moc"
|
||||
@ -3,7 +3,6 @@ CONFIG += testcase # neccesary to have posibility to run: make check UnitTest
|
||||
|
||||
SOURCES += \
|
||||
tst_request.cpp
|
||||
HEADERS += \
|
||||
tst_request.h
|
||||
|
||||
|
||||
include(../../../serversdkint.pri)
|
||||
@ -1,9 +1,16 @@
|
||||
#include "tst_request.h"
|
||||
#include <QtTest>
|
||||
|
||||
#include "serversdk/request.h"
|
||||
|
||||
namespace serversdk {
|
||||
|
||||
class RequestTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
Q_SLOT void basicAuthorization_test();
|
||||
};
|
||||
|
||||
void RequestTest::basicAuthorization_test()
|
||||
{
|
||||
QString expected = "Basic VGVzdGVyOlRlc3Q=";
|
||||
@ -17,3 +24,5 @@ void RequestTest::basicAuthorization_test()
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(serversdk::RequestTest)
|
||||
|
||||
#include "tst_request.moc"
|
||||
@ -1,21 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
namespace serversdk {
|
||||
|
||||
class RequestTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
// Default testcases ( not needed to declare it )
|
||||
// Q_SLOT void initTestCase();
|
||||
// Q_SLOT void cleanupTestCase();
|
||||
// void wont_run(); // no Q_SLOT ( only slots will be runned within tests )
|
||||
|
||||
|
||||
Q_SLOT void basicAuthorization_test();
|
||||
};
|
||||
|
||||
} //
|
||||
Loading…
x
Reference in New Issue
Block a user