diff options
author | Saturneric <[email protected]> | 2021-12-25 01:54:57 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-25 01:54:57 +0000 |
commit | b5cd5eac82b6bbd8a00fb39c045d473d6517b5f4 (patch) | |
tree | f8ce246cb98222a24b8f59640d48a633464d333b /test/GpgCoreTestKeyModelAlone.cpp | |
parent | Continue to add Standalone Support. (diff) | |
download | GpgFrontend-b5cd5eac82b6bbd8a00fb39c045d473d6517b5f4.tar.gz GpgFrontend-b5cd5eac82b6bbd8a00fb39c045d473d6517b5f4.zip |
<refactor, test>(core, test): core improved and test gpg alone mode
1. let modules known their channels.
2. let factory create a channel.
3. reduce dumplicate code.
4. add type check for function object.
5. test gpg alone mode.
6. remove some asserts.
7. rename importexportor to importexporter.
8. move args in gpg context constructor to a struct.
Diffstat (limited to 'test/GpgCoreTestKeyModelAlone.cpp')
-rw-r--r-- | test/GpgCoreTestKeyModelAlone.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/test/GpgCoreTestKeyModelAlone.cpp b/test/GpgCoreTestKeyModelAlone.cpp index ecc7bcd2..3d5bd175 100644 --- a/test/GpgCoreTestKeyModelAlone.cpp +++ b/test/GpgCoreTestKeyModelAlone.cpp @@ -25,18 +25,12 @@ #include "GpgFrontendTest.h" #include "gpg/function/GpgKeyGetter.h" -// Should be used once and once-only -INITIALIZE_EASYLOGGINGPP - TEST_F(GpgCoreTest, CoreInitTestAlone) { auto& ctx = GpgFrontend::GpgContext::GetInstance(gpg_alone_channel); - auto& ctx_default = GpgFrontend::GpgContext::GetInstance(); ASSERT_TRUE(ctx.good()); - ASSERT_TRUE(ctx_default.good()); - ASSERT_EQ(ctx_default.GetInfo().DatabasePath, "default"); } -TEST_F(GpgCoreTest, GpgDataTest) { +TEST_F(GpgCoreTest, GpgDataTestAlone) { auto data_buff = std::string( "cqEh8fyKWtmiXrW2zzlszJVGJrpXDDpzgP7ZELGxhfZYFi8rMrSVKDwrpFZBSWMG"); @@ -46,6 +40,12 @@ TEST_F(GpgCoreTest, GpgDataTest) { ASSERT_EQ(out_buffer->size(), 64); } +TEST_F(GpgCoreTest, GpgKeyFetchTestAlone) { + auto keys = + GpgFrontend::GpgKeyGetter::GetInstance(gpg_alone_channel).FetchKey(); + ASSERT_EQ(keys->size(), 4); +} + TEST_F(GpgCoreTest, GpgKeyTestAlone) { auto key = GpgFrontend::GpgKeyGetter::GetInstance(gpg_alone_channel) .GetKey("9490795B78F8AFE9F93BD09281704859182661FB"); @@ -135,28 +135,16 @@ TEST_F(GpgCoreTest, GpgUIDTestAlone) { ASSERT_FALSE(uid.revoked()); } -TEST_F(GpgCoreTest, GpgKeySignatureTest) { +TEST_F(GpgCoreTest, GpgKeySignatureTestAlone) { auto key = GpgFrontend::GpgKeyGetter::GetInstance(gpg_alone_channel) .GetKey("9490795B78F8AFE9F93BD09281704859182661FB"); auto uids = key.uids(); ASSERT_EQ(uids->size(), 1); auto& uid = uids->front(); + // No key signature support auto signatures = uid.signatures(); - ASSERT_EQ(signatures->size(), 1); - auto& signature = signatures->front(); - - ASSERT_EQ(signature.name(), "GpgFrontendTest"); - ASSERT_TRUE(signature.comment().empty()); - ASSERT_EQ(signature.email(), "[email protected]"); - ASSERT_EQ(signature.keyid(), "81704859182661FB"); - ASSERT_EQ(signature.pubkey_algo(), "RSA"); - - ASSERT_FALSE(signature.revoked()); - ASSERT_FALSE(signature.invalid()); - ASSERT_EQ(GpgFrontend::check_gpg_error_2_err_code(signature.status()), - GPG_ERR_NO_ERROR); - ASSERT_EQ(signature.uid(), "GpgFrontendTest <[email protected]>"); + ASSERT_EQ(signatures->size(), 0); } TEST_F(GpgCoreTest, GpgKeyGetterTestAlone) { |