Skip to content

Commit

Permalink
tests: fix catching error message
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 6, 2024
1 parent e1a9595 commit e8b7dfa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_cli_upload_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pathlib
import sys
from unittest import mock
import uuid

import pytest

Expand Down Expand Up @@ -100,16 +101,18 @@ def sys_exit(status):
path_task = pathlib.Path(
make_upload_task(resource_names=["cli_upload.rtdc"]))
api = get_api()
ret_val = cli.upload_task(path_task=path_task,
server="does.not.exist.example.com",
api_key=api.api_key,
retries_wait=.01,
ret_job=False)
ret_val = cli.upload_task(
path_task=path_task,
server=f"{uuid.uuid4()}.does.not.exist.example.com",
api_key=api.api_key,
retries_wait=.01,
ret_job=False)
assert ret_val != 0
path_error = path_task.parent / (path_task.name + "_error.txt")
assert path_error.exists()
err_text = path_error.read_text()
assert err_text.count("Failed to resolve")
assert (err_text.count("Failed to resolve")
or err_text.count("Failed to establish a new connection"))
assert err_text.count("does.not.exist.example.com")

stdout_printed = mock_stdout.getvalue()
Expand Down

0 comments on commit e8b7dfa

Please sign in to comment.