On 2014年09月25日 21:46, Crístian Viana wrote:
On 25-09-2014 08:12, lvroyce(a)linux.vnet.ibm.com wrote:
> - data = upload_file.file.read(8192)
> + data = upload_file.file.read(8192*32)
> if not data:
> break
> size += len(data)
The variable "data" doesn't seem to be used anywhere else after
receiving data from the upload file. So why are we even reading it?
Can't we skip the reading operation completely and just store the
"volume"? It's a mock environment.
I think why it is added on the
first occasion is to test the status
update (I mean progress) of reading, if no reading, no progress we can see.
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index 7eb6233..fa44985 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -1948,8 +1948,10 @@ class RestTests(unittest.TestCase):
> self.assertEquals(r.status_code, 202)
> task = r.json()
> self._wait_task(task['id'])
> + time.sleep(5)
The function "_wait_task" has an optional parameter which selects the
maximum time it will wait for the task, in seconds. Its default value
is 5. If you need to wait another 5 seconds, I'd suggest using:
self._wait_task(task['id'], 10)
ACK
rather than adding another sleep command.
But I guess this won't be necessary if we skip reading the file as I
suggested above.