make tests pass

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2022-02-27 22:24:39 -08:00
parent 65e95eae3d
commit ab01c82bb7
9 changed files with 14 additions and 221 deletions

View File

@ -1094,7 +1094,7 @@ def camel_to_snake(name: str):
def camel_to_screaming_snake(name: str):
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).upper()
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).replace(' ', '').upper()
if (__name__ == '__main__'):

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Union
import base64
import httpx
from ...client import AuthenticatedClient
from ...client import Client
from ...models.file_conversion import FileConversion
from ...types import Response
from ...api.file.file_conversion_status import sync as fc_sync, asyncio as fc_asyncio
@ -12,7 +12,7 @@ from ...api.file.file_conversion_status import sync as fc_sync, asyncio as fc_as
def sync(
id: str,
*,
client: AuthenticatedClient,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""
@ -30,7 +30,7 @@ def sync(
async def asyncio(
id: str,
*,
client: AuthenticatedClient,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
"""Get the status of a file conversion. This function automatically base64 decodes the output response if there is one."""

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Union
import base64
import httpx
from ...client import AuthenticatedClient
from ...client import Client
from ...models.file_conversion import FileConversion
from ...models.valid_file_type import ValidFileType
from ...types import Response
@ -14,7 +14,7 @@ def sync(
output_format: ValidFileType,
content: bytes,
*,
client: AuthenticatedClient,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""
@ -38,7 +38,7 @@ async def asyncio(
output_format: ValidFileType,
content: bytes,
*,
client: AuthenticatedClient,
client: Client,
) -> Optional[Union[Any, FileConversion]]:
"""Convert a CAD file from one format to another. If the file being converted is larger than a certain size it will be performed asynchronously. This function automatically base64 encodes the request body and base64 decodes the request output."""

View File

@ -2,8 +2,8 @@ import os
import pytest
import asyncio
from .client import AuthenticatedClientFromEnv
from .models import FileConversion, ValidOutputFileFormat, ValidSourceFileFormat, AuthSession, InstanceMetadata, Message
from .client import ClientFromEnv
from .models import FileConversion, ValidOutputFileFormat, ValidSourceFileFormat, AuthSession, Instance, PongMessage
from .api.file import post_file_conversion_with_base64_helper
from .api.meta import auth_session, instance_metadata, ping
@ -38,7 +38,7 @@ def test_get_instance():
client = ClientFromEnv()
# Get the instance.
instance: InstanceMetadata = instance_metadata.sync(client=client)
instance: Instance = instance_metadata.sync(client=client)
assert instance is not None
@ -51,7 +51,7 @@ async def test_get_instance_async():
client = ClientFromEnv()
# Get the instance.
instance: InstanceMetadata = await instance_metadata.asyncio(client=client)
instance: Instance = await instance_metadata.asyncio(client=client)
assert instance is not None
@ -63,7 +63,7 @@ def test_ping():
client = ClientFromEnv()
# Get the message.
message: Message = ping.sync(client=client)
message: PongMessage = ping.sync(client=client)
assert message is not None
@ -76,7 +76,7 @@ async def test_ping_async():
client = ClientFromEnv()
# Get the message.
message: Message = await ping.asyncio(client=client)
message: PongMessage = await ping.asyncio(client=client)
assert message is not None

View File

@ -1,10 +0,0 @@
from enum import Enum
class Environment(str, Enum):
DEVELOPMENT = "DEVELOPMENT"
PREVIEW = "PREVIEW"
PRODUCTION = "PRODUCTION"
def __str__(self) -> str:
return str(self.value)

View File

@ -4,7 +4,7 @@ from enum import Enum
class FileConversionStatus(str, Enum):
QUEUED = 'Queued'
UPLOADED = 'Uploaded'
IN _PROGRESS = 'In Progress'
IN_PROGRESS = 'In Progress'
COMPLETED = 'Completed'
FAILED = 'Failed'

View File

@ -1,133 +0,0 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.environment import Environment
from ..types import UNSET, Unset
T = TypeVar("T", bound="InstanceMetadata")
@attr.s(auto_attribs=True)
class InstanceMetadata:
""" """
cpu_platform: Union[Unset, str] = UNSET
description: Union[Unset, str] = UNSET
environment: Union[Unset, Environment] = UNSET
git_hash: Union[Unset, str] = UNSET
hostname: Union[Unset, str] = UNSET
id: Union[Unset, str] = UNSET
image: Union[Unset, str] = UNSET
ip_address: Union[Unset, str] = UNSET
machine_type: Union[Unset, str] = UNSET
name: Union[Unset, str] = UNSET
zone: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
cpu_platform = self.cpu_platform
description = self.description
environment: Union[Unset, str] = UNSET
if not isinstance(self.environment, Unset):
environment = self.environment.value
git_hash = self.git_hash
hostname = self.hostname
id = self.id
image = self.image
ip_address = self.ip_address
machine_type = self.machine_type
name = self.name
zone = self.zone
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if cpu_platform is not UNSET:
field_dict["cpu_platform"] = cpu_platform
if description is not UNSET:
field_dict["description"] = description
if environment is not UNSET:
field_dict["environment"] = environment
if git_hash is not UNSET:
field_dict["git_hash"] = git_hash
if hostname is not UNSET:
field_dict["hostname"] = hostname
if id is not UNSET:
field_dict["id"] = id
if image is not UNSET:
field_dict["image"] = image
if ip_address is not UNSET:
field_dict["ip_address"] = ip_address
if machine_type is not UNSET:
field_dict["machine_type"] = machine_type
if name is not UNSET:
field_dict["name"] = name
if zone is not UNSET:
field_dict["zone"] = zone
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
cpu_platform = d.pop("cpu_platform", UNSET)
description = d.pop("description", UNSET)
_environment = d.pop("environment", UNSET)
environment: Union[Unset, Environment]
if isinstance(_environment, Unset):
environment = UNSET
else:
environment = Environment(_environment)
git_hash = d.pop("git_hash", UNSET)
hostname = d.pop("hostname", UNSET)
id = d.pop("id", UNSET)
image = d.pop("image", UNSET)
ip_address = d.pop("ip_address", UNSET)
machine_type = d.pop("machine_type", UNSET)
name = d.pop("name", UNSET)
zone = d.pop("zone", UNSET)
instance_metadata = cls(
cpu_platform=cpu_platform,
description=description,
environment=environment,
git_hash=git_hash,
hostname=hostname,
id=id,
image=image,
ip_address=ip_address,
machine_type=machine_type,
name=name,
zone=zone,
)
instance_metadata.additional_properties = d
return instance_metadata
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,54 +0,0 @@
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Message")
@attr.s(auto_attribs=True)
class Message:
""" """
message: Union[Unset, str] = UNSET
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
message = self.message
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if message is not UNSET:
field_dict["message"] = message
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
message = d.pop("message", UNSET)
message = cls(
message=message,
)
message.additional_properties = d
return message
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties

View File

@ -1,10 +0,0 @@
from enum import Enum
class ValidFileType(str, Enum):
OBJ = "obj"
STL = "stl"
DAE = "dae"
def __str__(self) -> str:
return str(self.value)