pytest: add tests for getting a non-existing ftp file

Check that return code is 78.

Closes #18463
This commit is contained in:
Stefan Eissing 2025-09-03 11:21:42 +02:00 committed by Daniel Stenberg
parent 967a626af4
commit 9f1102cf74
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 21 additions and 0 deletions

View file

@ -215,6 +215,13 @@ class TestVsFTPD:
r.check_stats(count=count, http_status=226)
self.check_upload(env, vsftpd, docname=docname, binary=False)
def test_30_11_download_non_existing(self, env: Env, vsftpd: VsFTPD):
curl = CurlClient(env=env)
url = f'ftp://{env.ftp_domain}:{vsftpd.port}/does-not-exist'
r = curl.ftp_get(urls=[url], with_stats=True)
r.check_exit_code(78)
r.check_stats(count=1, exitcode=78)
def check_downloads(self, client, srcfile: str, count: int,
complete: bool = True):
for i in range(count):

View file

@ -246,6 +246,13 @@ class TestVsFTPD:
expdata = [indata] if len(indata) else []
assert expdata == destdata, f'expected: {expdata}, got: {destdata}'
def test_31_11_download_non_existing(self, env: Env, vsftpds: VsFTPD):
curl = CurlClient(env=env)
url = f'ftp://{env.ftp_domain}:{vsftpds.port}/does-not-exist'
r = curl.ftp_ssl_get(urls=[url], with_stats=True)
r.check_exit_code(78)
r.check_stats(count=1, exitcode=78)
def check_downloads(self, client, srcfile: str, count: int,
complete: bool = True):
for i in range(count):

View file

@ -258,6 +258,13 @@ class TestFtpsVsFTPD:
expdata = [indata] if len(indata) else []
assert expdata == destdata, f'expected: {expdata}, got: {destdata}'
def test_32_11_download_non_existing(self, env: Env, vsftpds: VsFTPD):
curl = CurlClient(env=env)
url = f'ftps://{env.ftp_domain}:{vsftpds.port}/does-not-exist'
r = curl.ftp_get(urls=[url], with_stats=True)
r.check_exit_code(78)
r.check_stats(count=1, exitcode=78)
def check_downloads(self, client, srcfile: str, count: int,
complete: bool = True):
for i in range(count):