From: Stefan Eissing Date: Wed, 3 Sep 2025 09:21:42 +0000 (+0200) Subject: pytest: add tests for getting a non-existing ftp file X-Git-Tag: curl-8_16_0~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f1102cf740c30b3da8f5df299ae8c9c088fbce8;p=thirdparty%2Fcurl.git pytest: add tests for getting a non-existing ftp file Check that return code is 78. Closes #18463 --- diff --git a/tests/http/test_30_vsftpd.py b/tests/http/test_30_vsftpd.py index c6193c2c75..5f294fdfc8 100644 --- a/tests/http/test_30_vsftpd.py +++ b/tests/http/test_30_vsftpd.py @@ -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): diff --git a/tests/http/test_31_vsftpds.py b/tests/http/test_31_vsftpds.py index 63f4b695d2..a3a9e66ca5 100644 --- a/tests/http/test_31_vsftpds.py +++ b/tests/http/test_31_vsftpds.py @@ -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): diff --git a/tests/http/test_32_ftps_vsftpd.py b/tests/http/test_32_ftps_vsftpd.py index f6c55f5fc2..4a28612242 100644 --- a/tests/http/test_32_ftps_vsftpd.py +++ b/tests/http/test_32_ftps_vsftpd.py @@ -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):