Tests - operation in Hive - create proposal
Operation: create_proposal_operation, // 44
Configuration:
HIVE_PROPOSAL_FEE_INCREASE_DAYS, default mainnet value: 60 days
HIVE_TREASURY_FEE, default mainnet value: 10 HBD
HIVE_PROPOSAL_FEE_INCREASE_AMOUNT, default mainnet value: 1 HBD
Test cases:
-
1. User A creates a post, user A creates a proposal with receiver
= user A and the proposal lasts less than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
2. User A creates a post, user A creates a proposal with receiver
= user B and the proposal lasts less than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
3. User A creates a post, user B creates a proposal with receiver
= user A and the proposal lasts less than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
4. User A creates a post, user A creates a proposal with receiver
= user A and the proposal lasts more than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
5. User A creates a post, user A creates a proposal with receiver
= user B and the proposal lasts more than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
6. User A creates a post, user B creates a proposal with receiver
= user A and the proposal lasts more than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days).
Preconditions:
- There are users A and B.
- Users have enough funds (HBD) to pay fee for creating a proposal.
Steps:
Step 1: User creates the post.
Step 2: User creates the proposal according to description.
Expected results
- RC is reduced (from proposal creator balance).
- The
receiver
is correct. - The proposal is published.
- The proposal fee is calculated - the HBD balance is reduced by HIVE_TREASURY_FEE (10 HBD).
- Test 4, 5 and 6 - the HBD balance is reduced by HIVE_PROPOSAL_FEE_INCREASE_AMOUNT (1 HBD) for each day over 60.
- The virtual operation: proposal_fee_operation is generated.
Test cases (negative):
-
7. User A creates a post, user B tries to create a proposal with receiver
= user B and the proposal lasts less than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
8. User A creates a post, user B tries to create a proposal with receiver
= user C and the proposal lasts less than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
9. User A creates a post, user B tries to create a proposal with receiver
= user B and the proposal lasts more than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days). -
10. User A creates a post, user B tries to create a proposal with receiver
= user C and the proposal lasts more than HIVE_PROPOSAL_FEE_INCREASE_DAYS (60 days).
Preconditions:
- There are users A and B.
- Users have enough funds (HBD) to pay fee for creating a proposal.
Steps:
Step 1: User creates the post.
Step 2: User tries to create the proposal according to description.
Expected results
- The proposal is not created - an error occurs.
Edited by Mateusz Kudela