It's was hard but i have finally a beginning of test for start VPCS

This commit is contained in:
Julien Duponchelle committed 2015-01-15 13:02:43 +01:00
1 parent 0afea48e63
commit 6bb2b88f1a
6 files changed
+62 -47

No files matched your search

+13 -1
View File
@@ -16,7 +16,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
from unittest.mock import patch
import asyncio
from tests.utils import asyncio_patch
#Move loop to util
from tests.api.base import loop
from asyncio.subprocess import Process
from unittest.mock import patch, Mock
from gns3server.modules.vpcs.vpcs_device import VPCSDevice
from gns3server.modules.vpcs.vpcs_error import VPCSError
@@ -39,3 +45,9 @@ def test_vm_invalid_vpcs_path(tmpdir):
assert vm.name == "test"
assert vm.id == 42
def test_start(tmpdir, loop):
with asyncio_patch("asyncio.create_subprocess_exec", return_value=Mock()):
vm = VPCSDevice("test", 42, working_dir=str(tmpdir), path="/bin/test_fake")
loop.run_until_complete(asyncio.async(vm.start()))
assert vm.is_running() == True