added skip message for http test

This commit is contained in:
DYefremov
2019-03-18 22:54:59 +03:00
parent 3733bc395b
commit b26d982db4

View File

@@ -41,7 +41,7 @@ class TestException(Exception):
pass pass
def download_data(*, properties, download_type=DownloadType.ALL, callback=None): def download_data(*, properties, download_type=DownloadType.ALL, callback):
with FTP(host=properties["host"], user=properties["user"], passwd=properties["password"]) as ftp: with FTP(host=properties["host"], user=properties["user"], passwd=properties["password"]) as ftp:
ftp.encoding = "utf-8" ftp.encoding = "utf-8"
callback("FTP OK.\n") callback("FTP OK.\n")
@@ -292,10 +292,11 @@ def test_ftp(host, port, user, password, timeout=5):
raise TestException(e) raise TestException(e)
def test_http(host, port, user, password, timeout=5): def test_http(host, port, user, password, timeout=5, skip_message=False):
try: try:
params = urlencode({"text": "Connection test", "type": 2, "timeout": timeout}) params = urlencode({"text": "Connection test", "type": 2, "timeout": timeout})
url = "http://{}:{}/api/message?{}".format(host, port, params) params = "statusinfo" if skip_message else "message?{}".format(params)
url = "http://{}:{}/api/{}".format(host, port, params)
# authentication # authentication
init_auth(user, password, url) init_auth(user, password, url)