test/include/EngineTestSuite.h
author Krista Bennett <krista@pep-project.org>
Tue, 14 Aug 2018 10:01:15 +0200
branchENGINE-451
changeset 2824 34863e77a260
parent 2822 a33bdd73952a
parent 2823 f56e57460c61
permissions -rw-r--r--
Merged in 427 fixes
     1 #ifndef ENGINE_TEST_SUITE_H
     2 #define ENGINE_TEST_SUITE_H
     3 
     4 #include <cpptest.h>
     5 #include <string>
     6 #include <map>
     7 #include <vector>
     8 #include <utility>
     9 #include "pEpEngine.h"
    10 
    11 using namespace std;
    12 
    13 class EngineTestSuite : public Test::Suite {
    14     public:
    15         EngineTestSuite(string suitename, string test_home_dir);
    16         virtual ~EngineTestSuite();
    17         
    18         void add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()> test_func);
    19         
    20     protected:
    21         PEP_SESSION session;
    22         string test_home;
    23         string real_home;
    24         string prev_gpg_home;
    25         string name;
    26         
    27         string current_test_name;
    28 
    29 #define TEST_FAILED_MESSAGE_BUFSIZE 1000        
    30         char failed_msg_buf[TEST_FAILED_MESSAGE_BUFSIZE];
    31         
    32         std::map<std::string, void (Test::Suite::*)()> test_map;                
    33         
    34         string my_name;
    35         
    36         unsigned int number_of_tests;
    37         unsigned int on_test_number;
    38         
    39         string temp_test_home;
    40         
    41         virtual void setup();
    42         virtual void tear_down();
    43         
    44         void set_full_env();
    45         void set_full_env(const char* gpg_conf_copy_path, const char* gpg_agent_conf_file_copy_path, const char* db_conf_file_copy_path);
    46         void restore_full_env();
    47         void initialise_test_home();
    48         void set_my_name();    
    49 	
    50         void copy_conf_file_to_test_dir(const char* dest_path, const char* conf_orig_path, const char* conf_dest_name);
    51         
    52         std::vector<std::pair<std::string, std::string>> gpgdir_fileadd_queue;
    53         std::vector<std::pair<std::string, std::string>> homedir_fileadd_queue;
    54         void add_file_to_gpg_dir_queue(std::string copy_from, std::string dst_fname);    
    55         void add_file_to_home_dir_queue(std::string copy_from, std::string dst_fname);
    56         void process_file_queue(std::string dirname, std::vector<std::pair<std::string, std::string>> file_queue);
    57 
    58 };
    59 #endif