1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00
gns3-server/old_tests/dynamips/test_vmhandler.py

66 lines
2.1 KiB
Python
Raw Normal View History

2013-12-22 00:42:33 +00:00
from tornado.testing import AsyncHTTPTestCase
#from gns3server.plugins.dynamips import Dynamips
#from gns3server._compat import urlencode
from functools import partial
import tornado.web
import json
import tempfile
# class TestVMHandler(AsyncHTTPTestCase):
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def setUp(self):
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# AsyncHTTPTestCase.setUp(self)
# self.post_request = partial(self.http_client.fetch,
# self.get_url("/api/vms/dynamips"),
# self.stop,
# method="POST")
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def get_app(self):
# return tornado.web.Application(Dynamips().handlers())
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def test_endpoint(self):
# self.http_client.fetch(self.get_url("/api/vms/dynamips"), self.stop)
# response = self.wait()
# assert response.code == 200
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def test_upload(self):
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# try:
# from poster.encode import multipart_encode
# except ImportError:
# # poster isn't available for Python 3, let's just ignore the test
# return
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# file_to_upload = tempfile.NamedTemporaryFile()
# data, headers = multipart_encode({"file1": file_to_upload})
# body = ""
# for d in data:
# body += d
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# response = self.fetch('/api/vms/dynamips/storage/upload',
# headers=headers,
# body=body,
# method='POST')
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# assert response.code == 200
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def get_new_ioloop(self):
# return tornado.ioloop.IOLoop.instance()
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# def test_create_vm(self):
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# post_data = {"name": "R1",
# "platform": "c3725",
# "console": 2000,
# "aux": 3000,
# "image": "c3725.bin",
# "ram": 128}
2015-01-20 12:24:00 +00:00
#
2013-12-22 00:42:33 +00:00
# self.post_request(body=json.dumps(post_data))
# response = self.wait()
# assert(response.headers['Content-Type'].startswith('application/json'))
# expected = {"success": True}
# assert response.body.decode("utf-8") == json.dumps(expected)