From 7665a822068c1139dbbcba4fb4633ac95f752a6e Mon Sep 17 00:00:00 2001 From: tcezard Date: Fri, 23 Feb 2024 11:47:08 +0000 Subject: [PATCH] Fix tests --- tests/test_submit.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/test_submit.py b/tests/test_submit.py index d6e7ce8..518226e 100644 --- a/tests/test_submit.py +++ b/tests/test_submit.py @@ -6,7 +6,7 @@ import yaml from ebi_eva_common_pyutils.config import WritableConfig -from eva_sub_cli import SUB_CLI_CONFIG_FILE +from eva_sub_cli import SUB_CLI_CONFIG_FILE, is_submission_dir_writable from eva_sub_cli.validators.validator import READY_FOR_SUBMISSION_TO_EVA from eva_sub_cli.submit import StudySubmitter, SUB_CLI_CONFIG_KEY_SUBMISSION_ID, SUB_CLI_CONFIG_KEY_SUBMISSION_UPLOAD_URL @@ -43,7 +43,6 @@ def test_submit(self): with patch('eva_sub_cli.submit.requests.post', return_value=mock_initiate_response) as mock_post, \ patch('eva_sub_cli.submit.requests.put', return_value=mock_uploaded_response) as mock_put, \ patch.object(StudySubmitter, '_upload_submission'), \ - patch.object(StudySubmitter, 'verify_submission_dir'), \ patch.object(self.submitter, 'submission_dir', self.test_sub_dir): self.submitter.sub_config.set(READY_FOR_SUBMISSION_TO_EVA, value=True) @@ -68,7 +67,7 @@ def test_submit_with_config(self): mock_uploaded_response = MagicMock() mock_uploaded_response.status_code = 200 - self.submitter.verify_submission_dir(self.test_sub_dir) + assert is_submission_dir_writable(self.test_sub_dir) sub_config = WritableConfig(self.config_file, version='version1.0') sub_config.set(READY_FOR_SUBMISSION_TO_EVA, value=True) sub_config.write() @@ -88,12 +87,8 @@ def test_submit_with_config(self): assert sub_config_data[SUB_CLI_CONFIG_KEY_SUBMISSION_ID] == "mock_submission_id" assert sub_config_data[SUB_CLI_CONFIG_KEY_SUBMISSION_UPLOAD_URL] == "directory to use for upload" - def test_verify_submission_dir(self): - self.submitter.verify_submission_dir(self.test_sub_dir) - assert os.path.exists(self.test_sub_dir) - def test_sub_config_file_creation(self): - self.submitter.verify_submission_dir(self.test_sub_dir) + assert is_submission_dir_writable(self.test_sub_dir) self.submitter.sub_config.set('test_key', value='test_value') self.submitter.sub_config.write() @@ -102,9 +97,9 @@ def test_sub_config_file_creation(self): def test_sub_config_passed_as_param(self): with patch('eva_sub_cli.submit.get_auth', return_value=Mock(token=self.token)): + assert is_submission_dir_writable(self.test_sub_dir) sub_config = WritableConfig(self.config_file) with StudySubmitter(self.test_sub_dir, vcf_files=None, metadata_file=None, submission_config=sub_config) as submitter: - submitter.verify_submission_dir(self.test_sub_dir) submitter.sub_config.set('test_key', value='test_value') assert os.path.exists(self.config_file)