From 3b52ee4b70ee2da2962eea34526aacab0d8bf84b Mon Sep 17 00:00:00 2001 From: huyenngn Date: Mon, 9 Oct 2023 14:46:35 +0200 Subject: [PATCH] feat: separate attachment checksum --- polarion_rest_api_client/data_models.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/polarion_rest_api_client/data_models.py b/polarion_rest_api_client/data_models.py index 1e7d80c6..4a5582e4 100644 --- a/polarion_rest_api_client/data_models.py +++ b/polarion_rest_api_client/data_models.py @@ -110,13 +110,17 @@ def calculate_checksum(self) -> str: del data["checksum"] del data["id"] - for at in data["attachments"]: - del at["id"] + attachments = data.pop("attachments") data = dict(sorted(data.items())) converted = json.dumps(data).encode("utf8") - self._checksum = hashlib.sha256(converted).hexdigest() + converted_attachments = json.dumps(attachments).encode("utf8") + self._checksum = ( + hashlib.sha256(converted).hexdigest() + + " " + + hashlib.sha256(converted_attachments).hexdigest() + ) return self._checksum def get_current_checksum(self) -> str | None: