Try to fix VirtualBox create test.

This commit is contained in:
Jeremy committed 2015-01-20 15:28:40 -07:00
1 parent 984d47f9c8
commit 17f6223fb1
7 files changed
+29 -10

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ class Query:
def _example_file_path(self, method, path):
path = re.sub('[^a-z0-9]', '', path)
return "docs/api/examples/{}_{}.txt".format(method.lower(), path) # FIXME: cannot find path when running tests
return "docs/api/examples/{}_{}.txt".format(method.lower(), path)
def _get_unused_port():
+4 -4
View File
@@ -15,13 +15,13 @@
# You should have received a copy of the GNU General Public License
# 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
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"):
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.route == "/virtualbox"
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):
response = server.post("/virtualbox/61d61bdd-aa7d-4912-817f-65a9eb54d3ab/stop", {}, example=False)
assert response.status == 200
assert response.route == "/virtualbox/{uuid}/stop"
assert response.route == "/virtualbox/{uuid}/stop"