1939
assets/ORIGINALVOXEL-3.obj
Normal file
1939
assets/ORIGINALVOXEL-3.obj
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -26,7 +26,7 @@ def sync(
|
|||||||
|
|
||||||
if isinstance(fc, FileConversion) and fc.output != "":
|
if isinstance(fc, FileConversion) and fc.output != "":
|
||||||
if isinstance(fc.output, str):
|
if isinstance(fc.output, str):
|
||||||
b = base64.b64decode(fc.output + "===")
|
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
|
||||||
return (fc, b)
|
return (fc, b)
|
||||||
|
|
||||||
return fc
|
return fc
|
||||||
@ -52,7 +52,7 @@ async def asyncio(
|
|||||||
|
|
||||||
if isinstance(fc, FileConversion) and fc.output != "":
|
if isinstance(fc, FileConversion) and fc.output != "":
|
||||||
if isinstance(fc.output, str):
|
if isinstance(fc.output, str):
|
||||||
b = base64.b64decode(fc.output + "===")
|
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
|
||||||
return (fc, b)
|
return (fc, b)
|
||||||
|
|
||||||
return fc
|
return fc
|
||||||
|
@ -21,7 +21,7 @@ def sync(
|
|||||||
|
|
||||||
if isinstance(fc, FileConversion) and fc.output != "":
|
if isinstance(fc, FileConversion) and fc.output != "":
|
||||||
if isinstance(fc.output, str):
|
if isinstance(fc.output, str):
|
||||||
b = base64.b64decode(fc.output + "===")
|
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
|
||||||
return (fc, b)
|
return (fc, b)
|
||||||
|
|
||||||
return fc
|
return fc
|
||||||
@ -41,7 +41,7 @@ async def asyncio(
|
|||||||
|
|
||||||
if isinstance(fc, FileConversion) and fc.output != "":
|
if isinstance(fc, FileConversion) and fc.output != "":
|
||||||
if isinstance(fc.output, str):
|
if isinstance(fc.output, str):
|
||||||
b = base64.b64decode(fc.output + "===")
|
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
|
||||||
return (fc, b)
|
return (fc, b)
|
||||||
|
|
||||||
return fc
|
return fc
|
||||||
|
@ -167,6 +167,42 @@ async def test_file_convert_stl_async():
|
|||||||
assert len(b) > 0
|
assert len(b) > 0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_file_convert_obj_async():
|
||||||
|
# Create our client.
|
||||||
|
client = ClientFromEnv()
|
||||||
|
|
||||||
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
file = open(os.path.join(dir_path, "../assets/ORIGINALVOXEL-3.obj"), "rb")
|
||||||
|
content = file.read()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
# Get the fc.
|
||||||
|
result: Union[
|
||||||
|
Tuple[FileConversion, bytes], Error, None
|
||||||
|
] = await create_file_conversion_with_base64_helper.asyncio(
|
||||||
|
client=client,
|
||||||
|
body=content,
|
||||||
|
src_format=FileImportFormat.OBJ,
|
||||||
|
output_format=FileExportFormat.STL,
|
||||||
|
)
|
||||||
|
|
||||||
|
r: Tuple[FileConversion, bytes] = result # type: ignore
|
||||||
|
|
||||||
|
b: bytes = r[1]
|
||||||
|
fc: FileConversion = r[0]
|
||||||
|
|
||||||
|
print(f"FileConversion: {fc}")
|
||||||
|
|
||||||
|
assert fc.id is not None
|
||||||
|
assert fc.status == ApiCallStatus.COMPLETED
|
||||||
|
|
||||||
|
print(f"FileConversion: {fc}")
|
||||||
|
|
||||||
|
# Make sure the bytes are not empty.
|
||||||
|
assert len(b) > 0
|
||||||
|
|
||||||
|
|
||||||
def test_file_mass():
|
def test_file_mass():
|
||||||
# Create our client.
|
# Create our client.
|
||||||
client = ClientFromEnv()
|
client = ClientFromEnv()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "kittycad"
|
name = "kittycad"
|
||||||
version = "0.4.8"
|
version = "0.4.9"
|
||||||
description = "A client library for accessing KittyCAD"
|
description = "A client library for accessing KittyCAD"
|
||||||
|
|
||||||
authors = []
|
authors = []
|
||||||
|
Reference in New Issue
Block a user