Update StakingProviderInfo tests for TACoApplicationAgent and TACoChildApplicationAgent.

pull/3467/head
derekpierre 2024-04-25 10:50:31 -04:00
parent f2f7c24bba
commit 0f641363c2
No known key found for this signature in database
2 changed files with 40 additions and 9 deletions

View File

@ -2,7 +2,6 @@ import random
import pytest
from nucypher.blockchain.eth.agents import TACoApplicationAgent
from nucypher.blockchain.eth.constants import NULL_ADDRESS
from nucypher.blockchain.eth.signers.software import Web3Signer
from nucypher.crypto.powers import TransactingPower
@ -139,17 +138,19 @@ def test_sample_staking_providers(taco_application_agent, duration):
def test_get_staking_provider_info(
testerchain, taco_application_agent, get_random_checksum_address
taco_application_agent, ursulas, get_random_checksum_address
):
staking_provider_account, operator_account, *other = testerchain.unassigned_accounts
info: TACoApplicationAgent.StakingProviderInfo = (
taco_application_agent.get_staking_provider_info(
staking_provider=staking_provider_account
)
# existing staker
staking_provider, operator_address = (
ursulas[0].checksum_address,
ursulas[0].operator_address,
)
info = taco_application_agent.get_staking_provider_info(
staking_provider=staking_provider
)
assert info.operator_start_timestamp > 0
assert info.operator == operator_account
assert info.operator_confirmed is False
assert info.operator == operator_address
assert info.operator_confirmed is True
# non-existent staker
info = taco_application_agent.get_staking_provider_info(

View File

@ -154,3 +154,33 @@ def test_sample_staking_providers(taco_child_application_agent, duration):
assert len(set(providers)) == 3
assert len(set(providers).intersection(all_staking_providers)) == 3
assert len(set(providers).intersection(exclude_providers)) == 0
def test_get_staking_provider_info(
taco_child_application_agent, ursulas, get_random_checksum_address
):
# existing staker
staking_provider, operator_address = (
ursulas[0].checksum_address,
ursulas[0].operator_address,
)
info = taco_child_application_agent.staking_provider_info(
staking_provider=staking_provider
)
assert info.operator == operator_address
assert info.authorized > taco_child_application_agent.get_min_authorization()
assert info.operator_confirmed is True
assert info.index == 1
assert info.deauthorizing == 0
assert info.end_deauthorization == 0
# non-existent staker
info = taco_child_application_agent.staking_provider_info(
get_random_checksum_address()
)
assert info.operator == NULL_ADDRESS
assert info.authorized == 0
assert info.operator_confirmed is False
assert info.index == 0
assert info.deauthorizing == 0
assert info.end_deauthorization == 0