FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit b4522d1a authored by L. Bower's avatar L. Bower
Browse files

updating test for survey

parent 2eff9e5f
No related branches found
No related tags found
No related merge requests found
import json
from datetime import datetime
from zipfile import ZipFile
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"
@staticmethod
def load_json_file(file: str) -> dict:
......@@ -23,3 +25,10 @@ class IntegrationTestUtils:
def get_now_string() -> str:
nowstring: str = datetime.today().strftime('%Y-%m-%d_%H%M%S')
return nowstring
@staticmethod
def unpack_zip(zip_to_unpack: str, out_file: str):
with ZipFile(zip_to_unpack) as zf: # open the zip file
for target_file in zf.namelist(): # check if the file exists in the archive
zf.extract(target_file, out_file)
......@@ -14,8 +14,8 @@ class TestEnvSuit(unittest.TestCase):
def test_env_suit_standard_inputs_expected_results1(self):
# nowstring: str = IntegrationTestUtils.get_now_string()
nowstring: str = ""
nowstring: str = IntegrationTestUtils.get_now_string()
# nowstring: str = ""
os.environ["EMAIL_CRED"] = "../test_data/test_deployment/envs/Cred_gmail.json"
from Processor import run_Process, set_log_level
......@@ -29,7 +29,7 @@ class TestEnvSuit(unittest.TestCase):
set_log_level(args_dict['log_level'])
run_dict: dict = copy.deepcopy(self.default_config_dict)
test_out_path = run_dict['WorkspacePathout'] + nowstring + os.sep
test_out_path = run_dict['WorkspacePathout'] + "temp_" + nowstring + os.sep
run_dict['WorkspacePathout'] = test_out_path
run_dict['WorkspacePath'] = test_out_path
run_dict['Survey']['SkipServerDownload'] = True
......@@ -39,6 +39,8 @@ class TestEnvSuit(unittest.TestCase):
IntegrationTestUtils.write_json_file(run_dict, IntegrationTestUtils.TEMP_CONFIG_FILE_PATH)
IntegrationTestUtils.unpack_zip(IntegrationTestUtils.EXAMPLE_SURVEY_FILE_PATH, test_out_path)
run_Process(args_dict)
self.assertTrue(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment