Skip to content

Commit

Permalink
[refactor] Add pattern matching for transaction status check
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStroke committed May 6, 2024
1 parent 3a9206f commit 2865335
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions client_cli/pytests/src/client_cli/client_cli.py
Expand Up @@ -458,13 +458,11 @@ def _check_commit_in_output(self, transaction_hash, output):
try:
while idx < len(output):
obj, idx_next = decoder.raw_decode(output[idx:])
if (
obj.get("Pipeline", {}).get("entity_kind") == "Transaction"
and obj.get("Pipeline", {}).get("status") == "Committed"
and obj.get("Pipeline", {}).get("hash") == transaction_hash
):
return True
idx += idx_next
match obj:
case {"Pipeline": {"entity_kind": "Transaction", "status": "Committed",
"hash": hash}} if hash == transaction_hash:
return True
except json.JSONDecodeError:
return False
return False
Expand Down

0 comments on commit 2865335

Please sign in to comment.