Project

General

Profile

Actions

Feature improvement #15453

open

AssetHelper test cases

Added by Peter Mačuga 7 months ago. Updated 7 months ago.

Status:
Testing
Priority:
Normal
Target version:
-
Start date:
09/17/2024
Due date:
% Done:

60%

Estimated time:
custom category:
Backend
Co-assignee:
Sprint:
240930 w_tasks (Sep 30 - Oct 07)

Description

Create tests for asset helper, accommodate as many test cases as you can think of, main test cases include:

No collection

  • create new collection - handle if metadata fetch fails (emit warning logs, still handle the deposit correctly)

No AssetType - handle ERC721 and ERC1155 standards differently, test cases to test correct asset type creation, only need 1 per combination of contract_address, blockchain and token_id (this is possbily handled by database constraint, so you can catch that error and log it nicely, make sure the transaction continues correctly)

  • ERC721
  • - Sum of all assets.counts = 1, if you try to deposit to the same wallet emit warning and cancel deposit (possibly log that it was cancelled and for what reason)
  • - If you try to deposit delta > 1, emit error
  • ERC1155

No Asset

  • tests for is_virtual_asset T/F
  • tests for correct count
  • tests for single asset deposit/withdrawal
  • tests for multiple asset deposit/withdrawal

Asset already exits

  • similar to no asset tests cases

New features:

  • Traceback parameter in request - making it possible to trace the source of action call
  • cancelled transaction, transactions that were not succesful, however dont need to repeated
  • checks for ERC721, described above, ideally create a function that handles this, depending on collection.contract_type, could be a function in collection/asset_type or in one of the DTOs, up to you
Actions

Also available in: Atom PDF