From fbed15318b0bb12c1f2f500f5cf446b948b3a240 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Fri, 14 Apr 2017 00:34:40 +0200 Subject: [PATCH] Fix file request testcase --- src/Test/TestFileRequest.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Test/TestFileRequest.py b/src/Test/TestFileRequest.py index e53c83dc..9b42ffce 100644 --- a/src/Test/TestFileRequest.py +++ b/src/Test/TestFileRequest.py @@ -23,7 +23,7 @@ class TestFileRequest: # Invalid file response = connection.request("getFile", {"site": site.address, "inner_path": "invalid.file", "location": 0}) - assert "No such file or directory" in response["error"] + assert "File read error" in response["error"] # Location over size response = connection.request("getFile", {"site": site.address, "inner_path": "content.json", "location": 1024 * 1024}) @@ -31,7 +31,14 @@ class TestFileRequest: # Stream from parent dir response = connection.request("getFile", {"site": site.address, "inner_path": "../users.json", "location": 0}) - assert "File not allowed" in response["error"] + assert "File read error" in response["error"] + + # Invalid site + response = connection.request("getFile", {"site": "", "inner_path": "users.json", "location": 0}) + assert "Unknown site" in response["error"] + + response = connection.request("getFile", {"site": ".", "inner_path": "users.json", "location": 0}) + assert "Unknown site" in response["error"] connection.close() client.stop() @@ -50,7 +57,7 @@ class TestFileRequest: # Invalid file buff = StringIO.StringIO() response = connection.request("streamFile", {"site": site.address, "inner_path": "invalid.file", "location": 0}, buff) - assert "No such file or directory" in response["error"] + assert "File read error" in response["error"] # Location over size buff = StringIO.StringIO() @@ -62,7 +69,7 @@ class TestFileRequest: # Stream from parent dir buff = StringIO.StringIO() response = connection.request("streamFile", {"site": site.address, "inner_path": "../users.json", "location": 0}, buff) - assert "File not allowed" in response["error"] + assert "File read error" in response["error"] connection.close() client.stop()