diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-19 16:14:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-19 16:14:14 +0200 |
commit | 0f2c40957b438d0a2f5ce7cb2ba033bab077cbeb (patch) | |
tree | f6d147201d13885819d2c34462cf13f499fac944 /autotests | |
parent | 77b190d822c1e980b98b84999f0cfb609ed05a49 (diff) | |
parent | 5df53b8d5c8b21228ecf9938330dd4d85d3de6af (diff) | |
download | libquotient-0f2c40957b438d0a2f5ce7cb2ba033bab077cbeb.tar.gz libquotient-0f2c40957b438d0a2f5ce7cb2ba033bab077cbeb.zip |
Merge pull request #540 from TobiasFella/sendmessages
Implement sending encrypted messages
Diffstat (limited to 'autotests')
-rw-r--r-- | autotests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | autotests/testfilecrypto.cpp | 17 | ||||
-rw-r--r-- | autotests/testfilecrypto.h | 12 |
3 files changed, 30 insertions, 0 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 671d6c08..c11901bf 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -18,4 +18,5 @@ if(${PROJECT_NAME}_ENABLE_E2EE) quotient_add_test(NAME testgroupsession) quotient_add_test(NAME testolmsession) quotient_add_test(NAME testolmutility) + quotient_add_test(NAME testfilecrypto) endif() diff --git a/autotests/testfilecrypto.cpp b/autotests/testfilecrypto.cpp new file mode 100644 index 00000000..e6bec1fe --- /dev/null +++ b/autotests/testfilecrypto.cpp @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include "testfilecrypto.h" +#include "events/encryptedfile.h" +#include <qtest.h> + +using namespace Quotient; +void TestFileCrypto::encryptDecryptData() +{ + QByteArray data = "ABCDEF"; + auto [file, cipherText] = EncryptedFile::encryptFile(data); + auto decrypted = file.decryptFile(cipherText); + QCOMPARE(data, decrypted); +} +QTEST_APPLESS_MAIN(TestFileCrypto) diff --git a/autotests/testfilecrypto.h b/autotests/testfilecrypto.h new file mode 100644 index 00000000..9096a8c7 --- /dev/null +++ b/autotests/testfilecrypto.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include <QtTest/QtTest> + +class TestFileCrypto : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void encryptDecryptData(); +}; |