Browse Source

z/OS support: Adding test

Adding a basic test to check whether everything z/OS specific works
master
David Lanzendörfer 4 weeks ago
parent
commit
b3010e0e76
3 changed files with 153 additions and 0 deletions
  1. +108
    -0
      test/src/MainFrameTest.cc
  2. +17
    -0
      test/zos_key.asc
  3. +28
    -0
      test/zos_priv.asc

+ 108
- 0
test/src/MainFrameTest.cc View File

@ -0,0 +1,108 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <string.h>
#include <iostream>
#include <fstream>
#include <string>
#include <cstring> // for strcmp()
#include "platform.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include "keymanagement.h"
#include "message_api.h"
#include "mime.h"
#include "TestUtilities.h" // for slurp()
#include "TestConstants.h"
#include "Engine.h"
#include <gtest/gtest.h>
namespace {
//The fixture for MainFrameTest
class MainFrameTest : public ::testing::Test {
public:
Engine* engine;
PEP_SESSION session;
protected:
// You can remove any or all of the following functions if its body
// is empty.
MainFrameTest() {
// You can do set-up work for each test here.
test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM();
test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name();
test_path = get_main_test_home_dir() + "/" + test_suite_name + "/" + test_name;
}
~MainFrameTest() override {
// You can do clean-up work that doesn't throw exceptions here.
}
// If the constructor and destructor are not enough for setting up
// and cleaning up each test, you can define the following methods:
void SetUp() override {
// Code here will be called immediately after the constructor (right
// before each test).
// Leave this empty if there are no files to copy to the home directory path
std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
}
void TearDown() override {
// Code here will be called immediately after each test (right
// before the destructor).
engine->shut_down();
delete engine;
engine = NULL;
session = NULL;
}
private:
const char* test_suite_name;
const char* test_name;
string test_path;
// Objects declared here can be used by all tests in the AppleMailTest suite.
};
} // namespace
TEST_F( MainFrameTest, check_generation_of_keypairs ) {
char* keydata = NULL;
ofstream outfile;
size_t size = 0;
PEP_STATUS status = PEP_STATUS_OK;
char *uniqname = strdup("IBMtestuser@testdomain.org");
pEp_identity * me = new_identity(uniqname, NULL, NULL, "IBM Test User");
status = generate_keypair(session, me);
status = export_secret_key(session, me->fpr, &keydata, &size);
outfile.open("zos_priv.asc");
outfile << keydata;
outfile.close();
status = export_key(session, me->fpr, &keydata, &size);
outfile.open("zos_key.asc");
outfile << keydata;
outfile.close();
}

+ 17
- 0
test/zos_key.asc View File

@ -0,0 +1,17 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: NetPGP for pEp 3.99.99/[beta0]
xsBNBGEDFTYBCAC6QzH8CrAAqEfu+nb3xRTliryJCRYZhTuZlAMDcZCMgE6puwR6cUfcdGs0i7tV
yH9XMpJUlMAASM0JGta3tyOkq/JFUzhTrPhjcSYwmYnZ+/WAoaXnNUpz1Rxa4edOxIxommdoii5Q
j2HYRXgJTZ1R2kMpIbu1l6WV4j2c5jmB7qFbHorPKvyaF5DmYpbAT+S9QAIESmFY+O/07ENkGfBm
cPa+QivV9CYTYb18iI/SZWCsseLTuGjgx28Wy7UsW0yE9oQzduQxqcmDCqa36hoL+8pvaquLImOY
Oxdb4ppxY9ZOc/oRYfl0UQaKi3orQB6i1VHcOnlucY95JHvH8uuzABEBAAHNKklCTSBUZXN0IFVz
ZXIgPElCTXRlc3R1c2VyQHRlc3Rkb21haW4ub3JnPsLAegQTAQIALgUCYQMVNgUJAeEzgAkQ6cHv
0/o4jq0CGQECGwYECwkHAgYVCAIJCgsCFgICHgEAAFuVB/9+hnE2pPC030mRLoa98TUkcNDj6pRi
rMgCpS+9xPgrqXaJgFsi7yjbqStfpYMn2eish8WGQKPxr20J4qjC4nR3qbWyiU5L+f7lMZWWEx3Q
zcHo5j3ItPh8ngrU9HQxUySl4J6Rcaml9lGX6l1NCNIn7+1ve7A6DxGHjHXXgcPOnPtYMxt8tpcx
tzSumvFasHvRvFZJwnbyCauxLoEo3vHnkoSrdNt8ZQQsKq5Rp9SdxGEY5ddoxWHrs0IPh7C947Qu
3SK+/wXnJkyQuLFWh93b2yNvaUZ9rZmHh3KIm1Wm/dSf+XnI1qRwd4/f2l8iL/nan2B7SPEB0rpd
5GaQS1I0
=ZKYr
-----END PGP PUBLIC KEY BLOCK-----

+ 28
- 0
test/zos_priv.asc View File

@ -0,0 +1,28 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: NetPGP for pEp 3.99.99/[beta0]
xcLYBGEDFTYBCAC6QzH8CrAAqEfu+nb3xRTliryJCRYZhTuZlAMDcZCMgE6puwR6cUfcdGs0i7tV
yH9XMpJUlMAASM0JGta3tyOkq/JFUzhTrPhjcSYwmYnZ+/WAoaXnNUpz1Rxa4edOxIxommdoii5Q
j2HYRXgJTZ1R2kMpIbu1l6WV4j2c5jmB7qFbHorPKvyaF5DmYpbAT+S9QAIESmFY+O/07ENkGfBm
cPa+QivV9CYTYb18iI/SZWCsseLTuGjgx28Wy7UsW0yE9oQzduQxqcmDCqa36hoL+8pvaquLImOY
Oxdb4ppxY9ZOc/oRYfl0UQaKi3orQB6i1VHcOnlucY95JHvH8uuzABEBAAEAB/sHikLSvigDzswi
q3b3br360NPzBDAl1lPkUq6QjB9a4LLOgiibQEy1au0QEnwB6/zjrcNosyDWohvSu4hnpX1G5EMJ
dWX5VS408Faobv66mU2F6IVLx8d8yuq77xsrAB/i+CUpgTaAwl0moSFL1x2AO8KuPpRXtIzadW8j
E9rOHKYsRIOt6qXRrnlLwMeiApB7cRSn9Em8YMsQtdm9NHJauYY2/ENUOji2TscrH3yMm93exNLT
05rKUL3ldFh6ZEPYZT6ufNs8a7vyp1Zz4AjwkhbqLKK47NhMkosaCooog6cjWY+WCd1N8zgjXIbO
lEC7bzVjuseCDM9mAX650UiJBADnIbJmsE6h4Ttw5ggEYKlo67e29d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