Test size errors on getFile
This commit is contained in:
parent
dca3c775d1
commit
b7106995b7
1 changed files with 8 additions and 0 deletions
|
@ -18,9 +18,13 @@ class TestFileRequest:
|
|||
connection = client.getConnection("127.0.0.1", 1544)
|
||||
file_server.sites[site.address] = site
|
||||
|
||||
# Normal request
|
||||
response = connection.request("getFile", {"site": site.address, "inner_path": "content.json", "location": 0})
|
||||
assert "sign" in response["body"]
|
||||
|
||||
response = connection.request("getFile", {"site": site.address, "inner_path": "content.json", "location": 0, "file_size": 4460})
|
||||
assert "sign" in response["body"]
|
||||
|
||||
# Invalid file
|
||||
response = connection.request("getFile", {"site": site.address, "inner_path": "invalid.file", "location": 0})
|
||||
assert "File read error" in response["error"]
|
||||
|
@ -40,6 +44,10 @@ class TestFileRequest:
|
|||
response = connection.request("getFile", {"site": ".", "inner_path": "users.json", "location": 0})
|
||||
assert "Unknown site" in response["error"]
|
||||
|
||||
# Invalid size
|
||||
response = connection.request("getFile", {"site": site.address, "inner_path": "content.json", "location": 0, "file_size": 1234})
|
||||
assert "File size does not match" in response["error"]
|
||||
|
||||
connection.close()
|
||||
client.stop()
|
||||
|
||||
|
|
Loading…
Reference in a new issue