Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-parker committed Aug 8, 2024
1 parent 7bf368e commit 2a4e846
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ena-submission/scripts/ena_submission_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def get_project_xml(project_set):
response.raise_for_status()
except requests.exceptions.RequestException as e:
error_message = (
f"Request failed with status:{response.status_code}, {e}. "
f"Response: {response.content}"
f"Request failed with status:{response.status_code}. Message: {e}. "
f"Response: {response.text}."
)
logger.warning(error_message)
errors.append(error_message)
Expand All @@ -108,7 +108,7 @@ def get_project_xml(project_set):
if not valid:
raise requests.exceptions.RequestException
except Exception as e:
error_message = f"Response is in unexpected format: {e} " f"Response: {response.content}"
error_message = f"Response is in unexpected format: {e}. " f"Response: {response.text}."
errors.append(error_message)
return CreationResults(results=None, errors=errors, warnings=warnings)
project_results = {
Expand Down
4 changes: 2 additions & 2 deletions ena-submission/scripts/test_ena_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_create_project_xml_failure(self, mock_post):
mock_post.return_value = mock_requests_post(200, test_xml_failure_response)
project_set = default_project_type()
response = create_ena_project(test_config, project_set)
error_message_part = "Response is in unexpected format."
error_message_part = "Response is in unexpected format"
self.assertIn(error_message_part, response.errors[0])

@mock.patch("requests.post")
Expand All @@ -93,7 +93,7 @@ def test_create_project_server_failure(self, mock_post):
mock_post.return_value.raise_for_status.side_effect = exceptions.RequestException()
project_set = default_project_type()
response = create_ena_project(test_config, project_set)
error_message_part = "Request failed with status:500."
error_message_part = "Request failed with status:500"
self.assertIn(error_message_part, response.errors[0])
error_message_part = "Response: Internal Server Error"
self.assertIn(error_message_part, response.errors[0])
Expand Down

0 comments on commit 2a4e846

Please sign in to comment.