-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #193 from Targoman/check_base_ticket_owner
Check base ticket owner
- Loading branch information
Showing
7 changed files
with
197 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
################################################################################ | ||
# QBuildSystem | ||
# | ||
# Copyright(c) 2021 by Targoman Intelligent Processing <http://tip.co.ir> | ||
# | ||
# Redistribution and use in source and binary forms are allowed under the | ||
# terms of BSD License 2.0. | ||
################################################################################ | ||
TEST_NAME = mtFunctionalTest | ||
|
||
HEADERS += \ | ||
testMT.hpp | ||
|
||
SOURCES += \ | ||
$$BASE_PROJECT_PATH/3rdParty/QtCurl/libsrc/QtCUrl.cpp \ | ||
main.cpp \ | ||
|
||
LIBS += -lcurl | ||
|
||
BASE_TEST_PATH = $$BASE_PROJECT_PATH/Interfaces/Test | ||
INCLUDEPATH += $$BASE_TEST_PATH | ||
include($$BASE_TEST_PATH/Test.pri) | ||
|
||
################################################################################ | ||
include($$QBUILD_PATH/templates/unitTestConfigs.pri) | ||
LIBS -= -lTargomanAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/****************************************************************************** | ||
# TargomanAPI: REST API for Targoman | ||
# | ||
# Copyright 2014-2020 by Targoman Intelligent Processing <http://tip.co.ir> | ||
# | ||
# TargomanAPI is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# TargomanAPI is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
# | ||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
# along with Targoman. If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
/** | ||
* @author S. Mehran M. Ziabary <ziabary@targoman.com> | ||
* @author Kambiz Zandi <kambizzandi@gmail.com> | ||
*/ | ||
|
||
#include <QtTest> | ||
#include "testBase.hpp" | ||
#include "testMT.hpp" | ||
|
||
TAPI_MARSHAL_TEST_VARIABLES | ||
|
||
int main(int _argc, char *_argv[]) { | ||
qDebug() << "--------------------------------------------------"; | ||
qDebug() << "-- test module: MT -------------------------------"; | ||
qDebug() << "--------------------------------------------------"; | ||
|
||
//--------------------- | ||
QString DBPrefix; | ||
int progArgsCount = 0; | ||
char **progArgs = findDBPrefixFromArguments(_argc, _argv, DBPrefix, progArgsCount); | ||
|
||
//--------------------- | ||
QCoreApplication App(progArgsCount, progArgs); | ||
App.setAttribute(Qt::AA_Use96Dpi, true); | ||
|
||
clsDAC::addDBEngine(enuDBEngines::MySQL); | ||
clsDAC::setConnectionString(QString("HOST=%1;PORT=%2;USER=%3;PASSWORD=%4;SCHEMA=%5%6") | ||
.arg(TARGOMAN_M2STR(UNITTEST_DB_HOST)) | ||
.arg(TARGOMAN_M2STR(UNITTEST_DB_PORT)) | ||
.arg(TARGOMAN_M2STR(UNITTEST_DB_USER)) | ||
.arg(TARGOMAN_M2STR(UNITTEST_DB_PASSWORD)) | ||
.arg(DBPrefix) | ||
.arg(TARGOMAN_M2STR(UNITTEST_DB_SCHEMA)) | ||
); | ||
|
||
bool BreakOnFirstFail = true; | ||
int FailedTests = 0; | ||
|
||
try { | ||
FailedTests += QTest::qExec(new testBase(DBPrefix), progArgsCount, progArgs); | ||
if (BreakOnFirstFail && !FailedTests) FailedTests += QTest::qExec(new testMT(DBPrefix), progArgsCount, progArgs); | ||
} catch (exTargomanBase &e) { | ||
++FailedTests; | ||
qDebug() << "*** EXCEPTION ***" << QString("error(%1):%2").arg(e.code()).arg(e.what()); | ||
} catch (std::exception &e) { | ||
++FailedTests; | ||
qDebug() << "*** EXCEPTION ***" << e.what(); | ||
} | ||
|
||
if (FailedTests > 0) { | ||
qDebug() << "total number of failed tests: " << FailedTests; | ||
} else { | ||
qDebug() << "all tests passed :)"; | ||
} | ||
|
||
clsDAC::shutdown(); | ||
|
||
return FailedTests; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/****************************************************************************** | ||
* TargomanAAA: Authentication, Authorization, Accounting framework * | ||
* * | ||
* Copyright 2014-2019 by Targoman Intelligent Processing <http://tip.co.ir> * | ||
* * | ||
* TargomanAAA is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU Lesser General Public License as published * | ||
* by the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* TargomanAAA is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Lesser General Public License for more details. * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with Targoman. If not, see <http://www.gnu.org/licenses/>. * | ||
* * | ||
******************************************************************************/ | ||
/** | ||
* @author S. Mehran M. Ziabary <ziabary@targoman.com> | ||
* @author Kambiz Zandi <kambizzandi@gmail.com> | ||
*/ | ||
|
||
#ifndef TEST_MT_HPP | ||
#define TEST_MT_HPP | ||
|
||
#include <QRandomGenerator> | ||
#include "Interfaces/Test/testCommon.hpp" | ||
#include "Interfaces/AAA/clsJWT.hpp" | ||
#include <cstdlib> | ||
#include <unistd.h> | ||
|
||
using namespace Targoman::API; | ||
using namespace Targoman::API::AAA; | ||
|
||
#include "Interfaces/DBM/QueryBuilders.h" | ||
using namespace Targoman::API::DBM; | ||
|
||
#include "Interfaces/AAA/Accounting_Defs.hpp" | ||
using namespace Targoman::API::AAA; | ||
|
||
#include "Interfaces/Helpers/SecurityHelper.h" | ||
using namespace Targoman::API::Helpers; | ||
|
||
class testMT : public clsBaseTest | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
testMT(const QString &_dbPrefix) : clsBaseTest(_dbPrefix) { ; } | ||
|
||
void cleanupUnitTestData() { | ||
clsDAC DAC; | ||
DAC.execQuery("", QString("UPDATE %1AAA.tblUser SET usrStatus='R' WHERE usrEmail IN(?,?)").arg(this->DBPrefix), { UT_UserEmail, UT_AdminUserEmail }); | ||
} | ||
|
||
private slots: | ||
void initTestCase() { | ||
initUnitTestData(false); | ||
} | ||
|
||
void cleanupTestCase() { | ||
gEncodedAdminJWT = ""; | ||
gEncodedJWT = ""; | ||
cleanupUnitTestData(); | ||
} | ||
|
||
}; | ||
|
||
#endif // TEST_MT_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters