Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wax
Commits
b8d20084
Commit
b8d20084
authored
4 months ago
by
Jakub Ziebinski
Browse files
Options
Downloads
Patches
Plain Diff
Add test for the impacted accounts
parent
46ec3f0e
No related branches found
No related tags found
1 merge request
!230
Implementation of the python wax interface
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/tests/base_api/__init__.py
+0
-0
0 additions, 0 deletions
python/tests/base_api/__init__.py
python/tests/base_api/test_operation_get_impacted_accounts.py
+55
-0
55 additions, 0 deletions
...on/tests/base_api/test_operation_get_impacted_accounts.py
with
55 additions
and
0 deletions
python/tests/base_api/__init__.py
0 → 100644
+
0
−
0
View file @
b8d20084
This diff is collapsed.
Click to expand it.
python/tests/base_api/test_operation_get_impacted_accounts.py
0 → 100644
+
55
−
0
View file @
b8d20084
from
__future__
import
annotations
import
json
from
typing
import
TYPE_CHECKING
,
Final
import
pytest
from
wax
import
create_wax_foundation
from
wax.proto
import
authority_pb2
,
operation_pb2
,
recover_account_pb2
if
TYPE_CHECKING
:
from
wax._private.models.operations
import
Operation
AUTHORITY_1
:
Final
[
authority_pb2
.
authority
]
=
authority_pb2
.
authority
(
weight_threshold
=
1
,
account_auths
=
{
"
account
"
:
1
,
"
account1
"
:
2
},
key_auths
=
{
"
STM76EQNV2RTA6yF9TnBvGSV71mW7eW36MM7XQp24JxdoArTfKA76
"
:
1
},
)
AUTHORITY_2
:
Final
[
authority_pb2
.
authority
]
=
authority_pb2
.
authority
(
weight_threshold
=
1
,
account_auths
=
{
"
account1
"
:
1
,
"
account2
"
:
2
},
key_auths
=
{
"
STM76EQNV2RTA6yF9TnBvGSV71mW7eW36MM7XQp24JxdoArTfKA76
"
:
1
},
)
RECOVER_ACCOUNT
:
Final
[
recover_account_pb2
.
recover_account
]
=
recover_account_pb2
.
recover_account
(
account_to_recover
=
"
account
"
,
new_owner_authority
=
AUTHORITY_1
,
recent_owner_authority
=
AUTHORITY_2
,
extensions
=
[]
)
PROTO_OPERATION
:
Final
[
operation_pb2
.
operation
]
=
operation_pb2
.
operation
(
recover_account
=
RECOVER_ACCOUNT
)
API_OPERATION_DICT
:
Final
[
dict
]
=
{
"
type
"
:
"
claim_reward_balance_operation
"
,
"
value
"
:
{
"
account
"
:
"
account
"
,
"
reward_hive
"
:
{
"
amount
"
:
"
0
"
,
"
precision
"
:
3
,
"
nai
"
:
"
@@000000021
"
},
"
reward_hbd
"
:
{
"
amount
"
:
"
0
"
,
"
precision
"
:
3
,
"
nai
"
:
"
@@000000013
"
},
"
reward_vests
"
:
{
"
amount
"
:
"
1
"
,
"
precision
"
:
6
,
"
nai
"
:
"
@@000000037
"
},
},
}
API_OPERATION_JSON
:
Final
[
str
]
=
json
.
dumps
(
API_OPERATION_DICT
)
EXPECTED_IMPACTED_ACCOUNT
:
Final
[
str
]
=
"
account
"
EXPECTED_AMOUNT_OF_IMPACTED_ACCOUNTS
:
Final
[
int
]
=
1
@pytest.mark.parametrize
(
"
operation
"
,
[
PROTO_OPERATION
,
API_OPERATION_DICT
,
API_OPERATION_JSON
])
def
test_operation_get_impacted_accounts
(
operation
:
Operation
)
->
None
:
# ARRANGE
wax
=
create_wax_foundation
()
# ACT
result
=
wax
.
get_operation_impacted_accounts
(
operation
)
# ASSERT
assert
len
(
result
)
==
EXPECTED_AMOUNT_OF_IMPACTED_ACCOUNTS
assert
result
[
0
]
==
EXPECTED_IMPACTED_ACCOUNT
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment