Git commit c431b535d60f760bd42ccb61dd25b329163837f6 by Valentin Rusu. Committed on 11/08/2015 at 14:29. Pushed by vrusu into branch 'master'. Also renaming the tests related to the store M +1 -1 autotests/CMakeLists.txt A +18 -0 autotests/ksecrets_store/CMakeLists.txt A +52 -0 autotests/ksecrets_store/ksecrets_store_test.cpp [Licens= e: LGPL (v2+)] A +36 -0 autotests/ksecrets_store/ksecrets_store_test.h [License:= LGPL (v2+)] http://commits.kde.org/ksecrets/c431b535d60f760bd42ccb61dd25b329163837f6 diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index e359f58..bfc99cf 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,2 +1,2 @@ add_subdirectory(api) -add_subdirectory(ksecrets_backend) +add_subdirectory(ksecrets_store) diff --git a/autotests/ksecrets_store/CMakeLists.txt b/autotests/ksecrets_s= tore/CMakeLists.txt new file mode 100644 index 0000000..facb282 --- /dev/null +++ b/autotests/ksecrets_store/CMakeLists.txt @@ -0,0 +1,18 @@ + +include(ECMMarkAsTest) +include(ECMAddTests) + +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test) + +include_directories(${CMAKE_SOURCE_DIR}/src/runtime/ksecrets_store) + +if(NOT Qt5Test_FOUND) + message(STATUS "Qt5Test not found, autotests will not be built.") + return() +endif() + +ecm_add_test( + ksecrets_store_test.cpp + LINK_LIBRARIES Qt5::Test ksecrets_store +) + diff --git a/autotests/ksecrets_store/ksecrets_store_test.cpp b/autotests/k= secrets_store/ksecrets_store_test.cpp new file mode 100644 index 0000000..ba70646 --- /dev/null +++ b/autotests/ksecrets_store/ksecrets_store_test.cpp @@ -0,0 +1,52 @@ +/* + This file is part of the KDE Libraries + + Copyright (C) 2015 Valentin Rusu (valir@kde.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public Lice= nse + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "ksecrets_backend_test.h" + +#include +#include +#include + +QTEST_GUILESS_MAIN(KSecretServiceStoreTest); + +const char* test_file_path =3D "~/.qttest/ksecretsbackend-test.dat"; + +KSecretServiceStoreTest::KSecretServiceStoreTest(QObject* parent) + : QObject(parent) +{ +} + +void KSecretServiceStoreTest::initTestCase() +{ +} + +void KSecretServiceStoreTest::cleanupTestCase() +{ + QDir::home().remove(QLatin1Literal(test_file_path)); +} + +void KSecretServiceStoreTest::testOpen() +{ + KSecretsStore backend; + auto openfut =3D backend.open(test_file_path, true); + auto openres =3D openfut.get(); + QVERIFY(openres.status_ =3D=3D KSecretsStore::OpenStatus::Good); +} diff --git a/autotests/ksecrets_store/ksecrets_store_test.h b/autotests/kse= crets_store/ksecrets_store_test.h new file mode 100644 index 0000000..a2e31a5 --- /dev/null +++ b/autotests/ksecrets_store/ksecrets_store_test.h @@ -0,0 +1,36 @@ +/* + This file is part of the KDE Libraries + + Copyright (C) 2015 Valentin Rusu (valir@kde.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public Lice= nse + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KSECRETSBACKENDTEST_H +#define KSECRETSBACKENDTEST_H + +#include + +class KSecretServiceStoreTest : public QObject { + Q_OBJECT +public: + explicit KSecretServiceStoreTest(QObject* parent =3D 0); +private Q_SLOTS: + void initTestCase(); + void testOpen(); + void cleanupTestCase(); +}; + +#endif