]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pytest: add tests for getting a non-existing ftp file
authorStefan Eissing <stefan@eissing.org>
Wed, 3 Sep 2025 09:21:42 +0000 (11:21 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 3 Sep 2025 10:51:00 +0000 (12:51 +0200)
Check that return code is 78.

Closes #18463

tests/http/test_30_vsftpd.py
tests/http/test_31_vsftpds.py
tests/http/test_32_ftps_vsftpd.py

index c6193c2c7599cbbe90f56637c2dd8294cdac44d6..5f294fdfc882df1b8e0c7b8c235891638e974b9b 100644 (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):
index 63f4b695d22e17f053ae244dba4b313b18810f4a..a3a9e66ca516b3126029b4cc91031e91d4cf6921 100644 (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):
index f6c55f5fc203438af7b20c6aa3e3b6fef1e80173..4a2861224274477208ea7a368144ebe719d1b5dc 100644 (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):