mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Use pydantic for data validation (instead of jsonschema)
Fix/improve various pydantic shema models.
This commit is contained in:
1 parent
d6a65883ee
commit
81439c750a
29 files changed
+784
-350
No files matched your search
@@ -655,7 +655,8 @@ async def test_clean_pictures_and_keep_supplier_logo(project):
|
||||
"""
|
||||
|
||||
project.supplier = {
|
||||
'logo': 'logo.png'
|
||||
'logo': 'logo.png',
|
||||
'url': 'http://acme.com'
|
||||
}
|
||||
|
||||
drawing = await project.add_drawing()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
import jsonschema
|
||||
import pydantic
|
||||
|
||||
from gns3server.controller.template import Template
|
||||
|
||||
@@ -39,7 +39,7 @@ def test_template_json():
|
||||
|
||||
def test_template_json_with_not_known_category():
|
||||
|
||||
with pytest.raises(jsonschema.ValidationError):
|
||||
with pytest.raises(pydantic.ValidationError):
|
||||
Template(None, {
|
||||
"node_type": "qemu",
|
||||
"name": "Test",
|
||||
|
||||
@@ -908,7 +908,12 @@ async def test_cloud_template_create(controller_api):
|
||||
"compute_id": "local",
|
||||
"default_name_format": "Cloud{0}",
|
||||
"name": "Cloud template",
|
||||
"symbol": ":/symbols/cloud.svg"}
|
||||
"ports_mapping": [],
|
||||
"symbol": ":/symbols/cloud.svg",
|
||||
"remote_console_host": "127.0.0.1",
|
||||
"remote_console_port": 23,
|
||||
"remote_console_type": "none",
|
||||
"remote_console_http_path": "/"}
|
||||
|
||||
for item, value in expected_response.items():
|
||||
assert response.json.get(item) == value
|
||||
|
||||
Reference in new issue
Block a user