
On 03-11-2014 14:12, Aline Manera wrote:
If you will use the new TaskModel.wait() function in all wait_task occurrences you should also remove the wait_task implementation from utils.py
They have different implementations. The function implemented on TaskModel is supposed to be used by the model (e.g. some_task.wait()), which is needed now to wait for "StorageVolumes.create". The one implemented in tests/utils.py is meant to be used for tests, especially for the REST tests (i.e. running "GET /tasks/1" and parsing its JSON result). The tests cannot use the model implementation because they don't use the model directly and the model cannot use the test implementation because it doesn't handle REST commands. Actually, the function in tests/utils.py receives a function as a parameter so it can handle different lookup approaches (i.e. by model / by REST). But IMO, when using the model directly, "wait" is not a "util" function and it should be defined in the model itself. So I think we have two options here: 1) Implement one "wait" function for the model and another one for the tests; 2) Implement one generic "wait" function and another one with the partial "lookup" implementation to handle the REST commands; More than one function will have to be implemented anyway. And I prefer option (1) because (2) looks like a workaround. What should I do?