Use Pydantic to validate the server config file.

This commit is contained in:
grossmj
2021-04-12 17:02:23 +09:30
parent 478119b40d
commit 30ebae207f
61 changed files with 871 additions and 695 deletions

View File

@ -22,6 +22,7 @@ from unittest.mock import patch, MagicMock
from gns3server.controller.project import Project
from gns3server.controller.compute import Compute, ComputeConflict
from gns3server.controller.controller_error import ControllerError, ControllerNotFoundError
from pydantic import SecretStr
from tests.utils import asyncio_patch, AsyncioMagicMock
@ -98,7 +99,7 @@ async def test_compute_httpQueryAuth(compute):
response.status = 200
compute.user = "root"
compute.password = "toor"
compute.password = SecretStr("toor")
await compute.post("/projects", {"a": "b"})
await compute.close()
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=compute._auth, chunked=None, timeout=20)