Just a quick 12 (well, 11) to 13 DDL test - since the functionality in the upgrade wasn't released anyway and key reset wasn't being used, there aren't extensive tests here, but I wanted to make sure it didn't just fail because we missed the path. sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 05 Feb 2020 14:25:31 +0100
branchsync
changeset 44081ee13762af7d
parent 4407 485be3d5da26
child 4409 727cc39f2ded
Just a quick 12 (well, 11) to 13 DDL test - since the functionality in the upgrade wasn't released anyway and key reset wasn't being used, there aren't extensive tests here, but I wanted to make sure it didn't just fail because we missed the path.
test/src/Quick11to12Test.cc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/src/Quick11to12Test.cc	Wed Feb 05 14:25:31 2020 +0100
     1.3 @@ -0,0 +1,86 @@
     1.4 +#include <stdlib.h>
     1.5 +#include <string>
     1.6 +#include <cstring>
     1.7 +#include <iostream>
     1.8 +#include <fstream>
     1.9 +
    1.10 +#include "pEpEngine.h"
    1.11 +#include "test_util.h"
    1.12 +#include "TestConstants.h"
    1.13 +#include "Engine.h"
    1.14 +#include "mime.h"
    1.15 +
    1.16 +#include <gtest/gtest.h>
    1.17 +
    1.18 +
    1.19 +namespace {
    1.20 +
    1.21 +	//The fixture for Quick11to12Test
    1.22 +    class Quick11to12Test : public ::testing::Test {
    1.23 +        public:
    1.24 +            Engine* engine;
    1.25 +            PEP_SESSION session;
    1.26 +
    1.27 +        protected:
    1.28 +            // You can remove any or all of the following functions if its body
    1.29 +            // is empty.
    1.30 +            Quick11to12Test() {
    1.31 +                // You can do set-up work for each test here.
    1.32 +                test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM();
    1.33 +                test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name();
    1.34 +                test_path = get_main_test_home_dir() + "/" + test_suite_name + "/" + test_name;
    1.35 +            }
    1.36 +
    1.37 +            ~Quick11to12Test() override {
    1.38 +                // You can do clean-up work that doesn't throw exceptions here.
    1.39 +            }
    1.40 +
    1.41 +            // If the constructor and destructor are not enough for setting up
    1.42 +            // and cleaning up each test, you can define the following methods:
    1.43 +
    1.44 +            void SetUp() override {
    1.45 +                // Code here will be called immediately after the constructor (right
    1.46 +                // before each test).
    1.47 +
    1.48 +                // Leave this empty if there are no files to copy to the home directory path
    1.49 +                std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();
    1.50 +
    1.51 +                init_files.push_back(std::pair<std::string, std::string>(std::string("test_files/DDL_11_Sequoia/.pEp_management.db"), std::string("management.db")));
    1.52 +                // Get a new test Engine.
    1.53 +                engine = new Engine(test_path);
    1.54 +                ASSERT_NE(engine, nullptr);
    1.55 +
    1.56 +                // Ok, let's initialize test directories etc.
    1.57 +                engine->prep(NULL, NULL, init_files);
    1.58 +
    1.59 +                // Ok, try to start this bugger.
    1.60 +                engine->start();
    1.61 +                ASSERT_NE(engine->session, nullptr);
    1.62 +                session = engine->session;
    1.63 +
    1.64 +                // Engine is up. Keep on truckin'
    1.65 +            }
    1.66 +
    1.67 +            void TearDown() override {
    1.68 +                // Code here will be called immediately after each test (right
    1.69 +                // before the destructor).
    1.70 +                engine->shut_down();
    1.71 +                delete engine;
    1.72 +                engine = NULL;
    1.73 +                session = NULL;
    1.74 +            }
    1.75 +
    1.76 +        private:
    1.77 +            const char* test_suite_name;
    1.78 +            const char* test_name;
    1.79 +            string test_path;
    1.80 +            // Objects declared here can be used by all tests in the Quick11to12Test suite.
    1.81 +
    1.82 +    };
    1.83 +
    1.84 +}  // namespace
    1.85 +
    1.86 +
    1.87 +TEST_F(Quick11to12Test, check_if_init_succeeds) {
    1.88 +    ASSERT_TRUE(true); 
    1.89 +}