mirror of https://github.com/GNS3/gns3-server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
11 years ago
|
from tornado.testing import AsyncHTTPTestCase
|
||
|
from gns3server.server import VersionHandler
|
||
|
from gns3server._compat import urlencode
|
||
|
import tornado.web
|
||
|
import json
|
||
|
|
||
|
# URL to test
|
||
|
URL = "/version"
|
||
|
|
||
|
|
||
|
class TestVersionHandler(AsyncHTTPTestCase):
|
||
|
|
||
|
def get_app(self):
|
||
|
return tornado.web.Application([(URL, VersionHandler)])
|
||
|
|
||
|
def test_endpoint(self):
|
||
|
self.http_client.fetch(self.get_url(URL), self.stop)
|
||
|
response = self.wait()
|
||
|
assert response.code == 200
|
||
|
|
||
|
# def test_post(self):
|
||
|
# data = urlencode({'test': 'works'})
|
||
|
# req = tornado.httpclient.HTTPRequest(self.get_url(URL),
|
||
|
# method='POST',
|
||
|
# body=data)
|
||
|
# self.http_client.fetch(req, self.stop)
|
||
|
# response = self.wait()
|
||
|
# assert response.code == 200
|
||
|
#
|
||
|
# def test_endpoint_differently(self):
|
||
|
# self.http_client.fetch(self.get_url(URL), self.stop)
|
||
|
# response = self.wait()
|
||
|
# assert(response.headers['Content-Type'].startswith('application/json'))
|
||
|
# assert(response.body != "")
|
||
|
# body = json.loads(response.body.decode('utf-8'))
|
||
|
# assert body['version'] == "0.1.dev"
|
||
|
|