diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97f4096c7f33fadfd5155bfe9d29fe848ff87fec..4f783d174fba7cc69f7d1659b1740f24c44b48ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,3 +56,4 @@ test: - python3 -m unittest test_deposition.py - python3 -m unittest test_env_suit.py - python3 -m unittest test_survey.py + - python3 -m unittest test_advisory.py diff --git a/tests/integration/integration_test_utils.py b/tests/integration/integration_test_utils.py index c668331891a9f7694a7aabae73d8796343527bad..53068253f677041636c8ef35af2458ca288c6b0a 100644 --- a/tests/integration/integration_test_utils.py +++ b/tests/integration/integration_test_utils.py @@ -7,6 +7,8 @@ class IntegrationTestUtils: TEMP_CONFIG_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/workspace/temp_config.json" EXAMPLE_SURVEY_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_survey_run.zip" + EXAMPLE_DEPO_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_depo_run.zip" + EXAMPLE_ENV_SUIT_FILE_PATH: str = "../test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_env_suit_run.zip" @staticmethod def load_json_file(file: str) -> dict: diff --git a/tests/integration/test_advisory.py b/tests/integration/test_advisory.py new file mode 100644 index 0000000000000000000000000000000000000000..c95e9bd1ad4bfe6c037d17979b48de4de5885033 --- /dev/null +++ b/tests/integration/test_advisory.py @@ -0,0 +1,49 @@ +import copy +import os +import unittest + +from integration.integration_test_utils import IntegrationTestUtils + + +class TestEnvSuit(unittest.TestCase): + + def setUp(self) -> None: + super().setUp() + default_config = '../test_data/test_deployment/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json' + self.default_config_dict: dict = IntegrationTestUtils.load_json_file(default_config) + + def test_env_suit_standard_inputs_expected_results1(self): + + nowstring: str = IntegrationTestUtils.get_now_string() + prefix: str = "temp_advisory_" + nowstring + # prefix: str = "" + + os.environ["EMAIL_CRED"] = "../test_data/test_deployment/envs/Cred_gmail.json" + from Processor import run_Process, set_log_level + args_dict: dict = {} + args_dict['component'] = 'Advisory' + args_dict['config_paths'] = [IntegrationTestUtils.TEMP_CONFIG_FILE_PATH] + args_dict['log_level'] = 'info' + args_dict['live'] = False + args_dict['start_date'] = '20221001' + args_dict['noupload'] = True + set_log_level(args_dict['log_level']) + + run_dict: dict = copy.deepcopy(self.default_config_dict) + test_out_path = run_dict['WorkspacePathout'] + prefix + os.sep + run_dict['WorkspacePathout'] = test_out_path + run_dict['WorkspacePath'] = test_out_path + run_dict['ServerName'] = '' # nothing, as local machine + + IntegrationTestUtils.write_json_file(run_dict, IntegrationTestUtils.TEMP_CONFIG_FILE_PATH) + + IntegrationTestUtils.unpack_zip(IntegrationTestUtils.EXAMPLE_SURVEY_FILE_PATH, test_out_path) + IntegrationTestUtils.unpack_zip(IntegrationTestUtils.EXAMPLE_DEPO_FILE_PATH, test_out_path) + IntegrationTestUtils.unpack_zip(IntegrationTestUtils.EXAMPLE_ENV_SUIT_FILE_PATH, test_out_path) + + run_Process(args_dict) + self.assertTrue(True) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_survey_run.zip b/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_survey_run.zip deleted file mode 100644 index 96454663ddc1949a8bbd24948a504193b9970842..0000000000000000000000000000000000000000 Binary files a/tests/test_data/test_deployment/regions/EastAfrica/resources/coordinator/assets/example_survey_run.zip and /dev/null differ