| |
@@ -1,7 +1,7 @@
|
| |
import pytest
|
| |
import mock
|
| |
from munch import Munch
|
| |
- from copr.v3.helpers import wait, succeeded
|
| |
+ from copr.v3.helpers import wait, succeeded, List
|
| |
from copr.v3 import BuildProxy, CoprException
|
| |
|
| |
|
| |
@@ -37,6 +37,12 @@
|
| |
mock_get.side_effect = lambda id: builds[id-1]
|
| |
assert wait(builds)
|
| |
|
| |
+ @mock.patch("copr.v3.proxies.build.BuildProxy.get")
|
| |
+ def test_wait_custom_list(self, mock_get):
|
| |
+ builds = List([Munch(id=1, state="succeeded"), Munch(id=2, state="failed")], proxy=BuildProxy({}))
|
| |
+ mock_get.side_effect = lambda self, id: builds[id-1]
|
| |
+ assert wait(builds)
|
| |
+
|
| |
@mock.patch("time.time")
|
| |
@mock.patch("copr.v3.proxies.build.BuildProxy.get")
|
| |
def test_wait_timeout(self, mock_get, mock_time):
|
| |
The
wait
function is supposed to work with onwaitable
instances.It should work on a
Munch
returned by other API method (i.e. it hasa
__proxy__
property), orlist
of such munches.It should also work on a
helpers.List
ofMunch
objects returnedby some API method. In such case, we set the
__proxy__
propertyto the
List
not munches themselves.