Fixed up test_db_api

This commit is contained in:
2024-01-13 19:02:55 +01:00
parent e7ec0a593c
commit a51e94fef3
21 changed files with 309 additions and 377 deletions

View File

@@ -21,7 +21,7 @@ from openapi_client.models.eventmessage_create import EventmessageCreate
from openapi_client.models.http_validation_error import HTTPValidationError
from openapi_client.models.machine import Machine
from openapi_client.models.resolution import Resolution
from openapi_client.models.roles import Roles
from openapi_client.models.role import Role
from openapi_client.models.service import Service
from openapi_client.models.service_create import ServiceCreate
from openapi_client.models.status import Status

View File

@@ -18,9 +18,9 @@ import re # noqa: F401
import json
from typing import Any, Dict
from pydantic import BaseModel, Field, StrictBool, StrictStr
from openapi_client.models.roles import Roles
from typing import Any, Dict, List
from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist
from openapi_client.models.role import Role
class Entity(BaseModel):
"""
@@ -30,12 +30,12 @@ class Entity(BaseModel):
name: StrictStr = Field(...)
ip: StrictStr = Field(...)
network: StrictStr = Field(...)
role: Roles = Field(...)
visible: StrictBool = Field(...)
other: Dict[str, Any] = Field(...)
attached: StrictBool = Field(...)
stop_health_task: StrictBool = Field(...)
__properties = ["did", "name", "ip", "network", "role", "visible", "other", "attached", "stop_health_task"]
roles: conlist(Role) = Field(...)
__properties = ["did", "name", "ip", "network", "visible", "other", "attached", "stop_health_task", "roles"]
class Config:
"""Pydantic configuration"""
@@ -77,11 +77,11 @@ class Entity(BaseModel):
"name": obj.get("name"),
"ip": obj.get("ip"),
"network": obj.get("network"),
"role": obj.get("role"),
"visible": obj.get("visible"),
"other": obj.get("other"),
"attached": obj.get("attached"),
"stop_health_task": obj.get("stop_health_task")
"stop_health_task": obj.get("stop_health_task"),
"roles": obj.get("roles")
})
return _obj

View File

@@ -18,9 +18,9 @@ import re # noqa: F401
import json
from typing import Any, Dict
from pydantic import BaseModel, Field, StrictBool, StrictStr
from openapi_client.models.roles import Roles
from typing import Any, Dict, List
from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist
from openapi_client.models.role import Role
class EntityCreate(BaseModel):
"""
@@ -30,10 +30,10 @@ class EntityCreate(BaseModel):
name: StrictStr = Field(...)
ip: StrictStr = Field(...)
network: StrictStr = Field(...)
role: Roles = Field(...)
visible: StrictBool = Field(...)
other: Dict[str, Any] = Field(...)
__properties = ["did", "name", "ip", "network", "role", "visible", "other"]
roles: conlist(Role) = Field(...)
__properties = ["did", "name", "ip", "network", "visible", "other", "roles"]
class Config:
"""Pydantic configuration"""
@@ -75,9 +75,9 @@ class EntityCreate(BaseModel):
"name": obj.get("name"),
"ip": obj.get("ip"),
"network": obj.get("network"),
"role": obj.get("role"),
"visible": obj.get("visible"),
"other": obj.get("other")
"other": obj.get("other"),
"roles": obj.get("roles")
})
return _obj

View File

@@ -25,7 +25,6 @@ class Eventmessage(BaseModel):
"""
Eventmessage
"""
id: StrictInt = Field(...)
timestamp: StrictInt = Field(...)
group: StrictInt = Field(...)
group_id: StrictInt = Field(...)
@@ -33,7 +32,8 @@ class Eventmessage(BaseModel):
src_did: StrictStr = Field(...)
des_did: StrictStr = Field(...)
msg: Dict[str, Any] = Field(...)
__properties = ["id", "timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"]
id: StrictInt = Field(...)
__properties = ["timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg", "id"]
class Config:
"""Pydantic configuration"""
@@ -71,14 +71,14 @@ class Eventmessage(BaseModel):
return Eventmessage.parse_obj(obj)
_obj = Eventmessage.parse_obj({
"id": obj.get("id"),
"timestamp": obj.get("timestamp"),
"group": obj.get("group"),
"group_id": obj.get("group_id"),
"msg_type": obj.get("msg_type"),
"src_did": obj.get("src_did"),
"des_did": obj.get("des_did"),
"msg": obj.get("msg")
"msg": obj.get("msg"),
"id": obj.get("id")
})
return _obj

View File

@@ -25,7 +25,6 @@ class EventmessageCreate(BaseModel):
"""
EventmessageCreate
"""
id: StrictInt = Field(...)
timestamp: StrictInt = Field(...)
group: StrictInt = Field(...)
group_id: StrictInt = Field(...)
@@ -33,7 +32,7 @@ class EventmessageCreate(BaseModel):
src_did: StrictStr = Field(...)
des_did: StrictStr = Field(...)
msg: Dict[str, Any] = Field(...)
__properties = ["id", "timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"]
__properties = ["timestamp", "group", "group_id", "msg_type", "src_did", "des_did", "msg"]
class Config:
"""Pydantic configuration"""
@@ -71,7 +70,6 @@ class EventmessageCreate(BaseModel):
return EventmessageCreate.parse_obj(obj)
_obj = EventmessageCreate.parse_obj({
"id": obj.get("id"),
"timestamp": obj.get("timestamp"),
"group": obj.get("group"),
"group_id": obj.get("group_id"),

View File

@@ -21,7 +21,7 @@ from aenum import Enum, no_arg
class Roles(str, Enum):
class Role(str, Enum):
"""
An enumeration.
"""
@@ -34,8 +34,8 @@ class Roles(str, Enum):
DLG = 'DLG'
@classmethod
def from_json(cls, json_str: str) -> Roles:
"""Create an instance of Roles from a JSON string"""
return Roles(json.loads(json_str))
def from_json(cls, json_str: str) -> Role:
"""Create an instance of Role from a JSON string"""
return Role(json.loads(json_str))