Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: qase-python-commons 3.1.1 #259

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qase-python-commons/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "qase-python-commons"
version = "3.1.0"
version = "3.1.1"
description = "A library for Qase TestOps and Qase Report"
readme = "README.md"
authors = [{name = "Qase Team", email = "[email protected]"}]
Expand Down
16 changes: 3 additions & 13 deletions qase-python-commons/src/qase/commons/models/attachment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import uuid
import json
import pathlib

from typing import Optional, Union
from io import BytesIO, StringIO
from typing import Optional
from io import BytesIO
from .basemodel import BaseModel


Expand All @@ -26,17 +24,8 @@ def __init__(self,
if (not isinstance(content, str)) and (not isinstance(content, bytes)):
self.content = json.dumps(self.content, default=lambda o: o.__dict__, sort_keys=False, indent=4)

self.size = self._get_size(content)
self.id = str(uuid.uuid4())

def _get_size(self, content):
if self.file_path:
return os.path.getsize(self.file_path)
elif content:
return len(content)
else:
return 0

def get_id(self) -> str:
return self.id

Expand All @@ -51,4 +40,5 @@ def get_for_upload(self) -> BytesIO:
content = BytesIO(self.content)
content.name = self.file_name
content.mime = self.mime_type

return content
Loading