Tests - operation in Hive - escrow related operations
Operations:
- escrow_transfer_operation, // 27
- escrow_approve_operation, // 31
- escrow_release_operation, // 29
- escrow_dispute_operation, // 28
1. Test cases - escrow_transfer_operation.
Preconditions:
- There are users: {from}, {to}, {agent}.
- The {from} has enough funds.
[ ] 1.1 A user {from} creates the escrow_transfer_operation
in Hive/HBD.
Expected results:
- The escrow is created.
- RC cost is paid by {form}.
- The Hive/HBD balance of {from} is decreased by { fee } for an agent.
- The Hive/HBD balance of {from} is decreased by escrow amount.
- The escrow amount is frozen, it is transferred to a temporary account after the operation escrow_approve_operation.
2. Test cases - escrow_approve_operation.
Preconditions:
- There are users: {from}, {to}, {agent}.
- There is a created escrow Hive/HBD.
-
2.1. {agent} and {to} approve the escrow with escrow_approve_operation
.
Expected results:
- The escrow is valid (I am not sure if it possible to check it - let me know).
- RC cost is paid by {agent}.
- RC cost is paid by {to}.
- The virtual operation
escrow_approved_operation
is generated. - The {agent} Hive/HBD balance is increased by fee amount.
-
2.2. {agent} approves the escrow with escrow_approve_operation
and the time for approval of {to} is over. -
2.3. {to} approves the escrow with escrow_approve_operation
and the time for approval of {agent} is over. -
2.4. Neither {agent} nor {to} approve the escrow the time for approval is over. -
2.5. {agent} rejects the escrow with escrow_approve_operation
. -
2.6. {to} rejects the escrow with escrow_approve_operation
. -
2.7 {agent} approves the escrow with escrow_approve_operation
and then {to} rejects the escrow withescrow_approve_operation
. -
2.8 {to} approves the escrow with escrow_approve_operation
and then {agent} rejects the escrow withescrow_approve_operation
.
Expected results:
- RC cost is paid by {to}/{agent}.
- The virtual operation
escrow_rejected_operation
is generated. - The {from} balance is increased by escrow amount.
- The {from} balance is increased by escrow fee amount.
3. Test cases - escrow_release_operation - the escrow has not expired.
Preconditions:
- There are users: {from}, {to}, {agent}.
- There is a created escrow Hive/HBD.
- There is no dispute.
- The escrow has not expired.
- The users {from} and {to} approves the escrow.
-
3.1. {agent} tries to release the escrow amount to {from}. -
3.2. {agent} tries to release the escrow amount to {to}. -
3.3. {from} tries to release the escrow amount to {from}. -
3.4. {to} tries to release the escrow amount to {to}.
Expected results:
- The error occurs.
-
3.5. {from} releases the escrow amount to {to}. -
3.6. {to} releases the escrow amount to {from}. -
3.7. {from} releases the part of the escrow amount to {to} and then part to {to} - two operations escrow_release_operation. -
3.8. {to} releases the part of the escrow amount to {from} and then part to {from} - two operations escrow_release_operation.
Expected results:
- RC cost is paid by {to}/{agent}/{from}.
- The {to}/{from} balance is increased by the released escrow amount.
4. Test cases - escrow_release_operation - the escrow expired.
Preconditions:
- There are users: {from}, {to}, {agent}.
- There is a created escrow Hive/HBD.
- There is no dispute.
- The escrow has expired.
- The users {from} and {to} approves the escrow.
-
4.1. {agent} tries to release the escrow amount to {from}. -
4.2. {agent} tries to release the escrow amount to {to}.
Expected results:
- The error occurs.
-
4.3. {from} releases the escrow amount to {from}. -
4.4. {to} releases the escrow amount to {to}. -
4.5. {from} releases the escrow amount to {to}. -
4.6. {to} releases the escrow amount to {from}. -
4.7. {from} releases the part of the escrow amount to {to} and then part to {to} - two operations escrow_release_operation. -
4.8. {to} releases the part of the escrow amount to {from} and then part to {from} - two operations escrow_release_operation.
Expected results:
- RC cost is paid by {to}/{agent}/{from}.
- The {to}/{from} balance is increased by the released escrow amount.
5. Test cases - escrow_release_operation with dispute (escrow_dispute_operation).
Preconditions:
- There are users: {from}, {to}, {agent}.
- There is a created escrow Hive/HBD.
- The escrow has not expired.
- There is no dispute.
- The users {from} and {to} approves the escrow.
-
5.1. {from} raises the dispute using escrow_dispute_operation operation. -
5.2. {to} raises the dispute using escrow_dispute_operation operation.
Expected results:
- RC cost is paid by {to}/{from}.
- The dispute is created.
- The {from} can not release the escrow amount to {from}/{to}.
- The {to} can not release the escrow amount to {from}/{to}.
-
5.3. {from} raises the dispute using escrow_dispute_operation operation and {agent} releases the whole escrow amount to {from}. -
5.4. {from} raises the dispute using escrow_dispute_operation operation and {agent} releases the whole escrow amount to {to}. -
5.5. {to} raises the dispute using escrow_dispute_operation operation and {agent} releases the whole escrow amount to {from}. -
5.6. {to} raises the dispute using escrow_dispute_operation operation and {agent} releases the whole escrow amount to {to}. -
5.7. {from} raises the dispute using escrow_dispute_operation operation and {agent} releases the part escrow amount to {from} and the part to {to}. -
5.8. {to} raises the dispute using escrow_dispute_operation operation and {agent} releases the part escrow amount to {from} and the part to {to}.
Expected results:
- RC cost is paid by {agent}.
- The {to}/{from} balance is increased by the released escrow amount.
Edited by Mateusz Kudela