diff options
author | Tobias Fella <fella@posteo.de> | 2022-03-08 00:06:36 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2022-03-10 20:03:35 +0100 |
commit | 2071f5020975bc3f5ecbb9e2444acaad8f13060a (patch) | |
tree | cf362b9c9c13c1172503c602c673a6a24b3d43c5 /autotests | |
parent | 0ef080bdfa3a8a64d1faadf4a11a8b9dbb5bc055 (diff) | |
download | libquotient-2071f5020975bc3f5ecbb9e2444acaad8f13060a.tar.gz libquotient-2071f5020975bc3f5ecbb9e2444acaad8f13060a.zip |
Implement sending encrypted files
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(); +}; |