Files
aqtinstall/tests/test_connection.py
Hiroshi Miura 79b5a297b5 Check version number and improve error messages (#102)
* Check Qt versions and report 404 error

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2020-03-01 11:35:39 +09:00

22 lines
831 B
Python

import pytest
import aqt
@pytest.mark.remote_data
def test_cli_unknown_version(capsys):
wrong_version = "5.12"
wrong_url = "https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/qt5_512/Updates.xml"
expected = ["aqt - WARNING - Specified Qt version is unknown: {}.".format(wrong_version),
"aqt - ERROR - Download error when access to {}"
" Server response code: 404, reason code: Not Found".format(wrong_url)
]
with pytest.raises(SystemExit) as pytest_wrapped_e:
cli = aqt.cli.Cli()
cli.run(["install", wrong_version, "mac", "desktop"])
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
out, err = capsys.readouterr()
for i, line in enumerate(out):
assert line.endswith(expected[i])