mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Return what is supported by a compute node
Ref https://github.com/GNS3/gns3-gui/issues/1448
This commit is contained in:
15 files changed
+210
-68
No files matched your search
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
This test suite check /version endpoint
|
||||
It's also used for unittest the HTTP implementation.
|
||||
"""
|
||||
|
||||
from gns3server.config import Config
|
||||
|
||||
from gns3server.version import __version__
|
||||
|
||||
|
||||
def test_get(http_compute):
|
||||
response = http_compute.get('/capabilities', example=True)
|
||||
assert response.status == 200
|
||||
assert response.json == {'node_types': ['cloud', 'nat', 'ethernet_hub', 'ethernet_switch', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__}
|
||||
@@ -23,7 +23,7 @@ def test_compute_create_without_id(http_controller, controller):
|
||||
|
||||
params = {
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -36,7 +36,7 @@ def test_compute_create_without_id(http_controller, controller):
|
||||
assert "password" not in response.json
|
||||
|
||||
assert len(controller.computes) == 1
|
||||
assert controller.computes[response.json["compute_id"]].host == "example.com"
|
||||
assert controller.computes[response.json["compute_id"]].host == "localhost"
|
||||
|
||||
|
||||
def test_compute_create_with_id(http_controller, controller):
|
||||
@@ -44,7 +44,7 @@ def test_compute_create_with_id(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -56,7 +56,7 @@ def test_compute_create_with_id(http_controller, controller):
|
||||
assert "password" not in response.json
|
||||
|
||||
assert len(controller.computes) == 1
|
||||
assert controller.computes["my_compute_id"].host == "example.com"
|
||||
assert controller.computes["my_compute_id"].host == "localhost"
|
||||
|
||||
|
||||
def test_compute_get(http_controller, controller):
|
||||
@@ -64,7 +64,7 @@ def test_compute_get(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -82,7 +82,7 @@ def test_compute_update(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -106,7 +106,7 @@ def test_compute_list(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure",
|
||||
@@ -124,13 +124,17 @@ def test_compute_list(http_controller, controller):
|
||||
assert compute == {
|
||||
'compute_id': 'my_compute_id',
|
||||
'connected': False,
|
||||
'host': 'example.com',
|
||||
'host': 'localhost',
|
||||
'port': 84,
|
||||
'protocol': 'http',
|
||||
'user': 'julien',
|
||||
'name': 'My super server',
|
||||
'cpu_usage_percent': None,
|
||||
'memory_usage_percent': None
|
||||
'memory_usage_percent': None,
|
||||
'capabilities': {
|
||||
'version': None,
|
||||
'node_types': []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +143,7 @@ def test_compute_delete(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute_id",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -162,7 +166,7 @@ def test_compute_list_images(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -181,7 +185,7 @@ def test_compute_list_vms(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
@@ -200,7 +204,7 @@ def test_compute_create_img(http_controller, controller):
|
||||
params = {
|
||||
"compute_id": "my_compute",
|
||||
"protocol": "http",
|
||||
"host": "example.com",
|
||||
"host": "localhost",
|
||||
"port": 84,
|
||||
"user": "julien",
|
||||
"password": "secure"
|
||||
|
||||
Reference in new issue
Block a user