Test size errors on getFile

This commit is contained in:
shortcutme 2017-06-19 16:14:14 +02:00
parent dca3c775d1
commit b7106995b7
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -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()