|
|
@ -15,13 +15,13 @@
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
from tests.api.base import server, loop
|
|
|
|
from tests.api.base import server, loop, project
|
|
|
|
from tests.utils import asyncio_patch
|
|
|
|
from tests.utils import asyncio_patch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_vbox_create(server):
|
|
|
|
def test_vbox_create(server, project):
|
|
|
|
with asyncio_patch("gns3server.modules.VirtualBox.create_vm", return_value="61d61bdd-aa7d-4912-817f-65a9eb54d3ab"):
|
|
|
|
with asyncio_patch("gns3server.modules.VirtualBox.create_vm", return_value="61d61bdd-aa7d-4912-817f-65a9eb54d3ab"):
|
|
|
|
response = server.post("/virtualbox", {"name": "VM1"}, example=False)
|
|
|
|
response = server.post("/virtualbox", {"name": "VM1", "vmname": "VM1", "project_uuid": project.uuid}, example=False)
|
|
|
|
assert response.status == 400
|
|
|
|
assert response.status == 400
|
|
|
|
assert response.route == "/virtualbox"
|
|
|
|
assert response.route == "/virtualbox"
|
|
|
|
assert response.json["name"] == "VM1"
|
|
|
|
assert response.json["name"] == "VM1"
|
|
|
@ -39,4 +39,4 @@ def test_vbox_stop(server):
|
|
|
|
with asyncio_patch("gns3server.modules.VirtualBox.stop_vm", return_value=True):
|
|
|
|
with asyncio_patch("gns3server.modules.VirtualBox.stop_vm", return_value=True):
|
|
|
|
response = server.post("/virtualbox/61d61bdd-aa7d-4912-817f-65a9eb54d3ab/stop", {}, example=False)
|
|
|
|
response = server.post("/virtualbox/61d61bdd-aa7d-4912-817f-65a9eb54d3ab/stop", {}, example=False)
|
|
|
|
assert response.status == 200
|
|
|
|
assert response.status == 200
|
|
|
|
assert response.route == "/virtualbox/{uuid}/stop"
|
|
|
|
assert response.route == "/virtualbox/{uuid}/stop"
|