Skip to content

Commit db0e4a9

Browse files
committed
feat: use get_drep_reg_record in test_drep.py
Refactor the test_drep.py to use the get_drep_reg_record function from governance_utils. This change simplifies the code by removing manual steps for generating drep registration certificates and deposit amounts. The function handles these internally, making the test code cleaner and more maintainable.
1 parent 47901e1 commit db0e4a9

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

cardano_node_tests/tests/tests_conway/test_drep.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -973,23 +973,17 @@ def test_drep_no_multiple_registration(
973973
drep_metadata_hash = cluster.g_conway_governance.drep.get_metadata_hash(
974974
drep_metadata_file=drep_metadata_file
975975
)
976-
deposit_amt = cluster.conway_genesis["dRepDeposit"]
977-
drep_keys = cluster.g_conway_governance.drep.gen_key_pair(
978-
key_name=temp_template, destination_dir="."
979-
)
976+
980977
reqc.cip090.start(url=helpers.get_vcs_link())
981-
# Obtain drep registration certificate
982-
reg_cert = cluster.g_conway_governance.drep.gen_registration_cert(
983-
cert_name=temp_template,
984-
deposit_amt=deposit_amt,
985-
drep_vkey_file=drep_keys.vkey_file,
978+
reg_drep = governance_utils.get_drep_reg_record(
979+
cluster_obj=cluster,
980+
name_template=temp_template,
986981
drep_metadata_url=drep_metadata_url,
987982
drep_metadata_hash=drep_metadata_hash,
988-
destination_dir=".",
989983
)
990984
tx_files_reg = clusterlib.TxFiles(
991-
certificate_files=[reg_cert],
992-
signing_key_files=[payment_addr.skey_file, drep_keys.skey_file],
985+
certificate_files=[reg_drep.registration_cert],
986+
signing_key_files=[payment_addr.skey_file, reg_drep.key_pair.skey_file],
993987
)
994988

995989
# Submit drep registration certificate
@@ -1000,7 +994,7 @@ def test_drep_no_multiple_registration(
1000994
submit_method=submit_method,
1001995
use_build_cmd=use_build_cmd,
1002996
tx_files=tx_files_reg,
1003-
deposit=deposit_amt,
997+
deposit=reg_drep.deposit,
1004998
)
1005999

10061000
# Wait for some blocks and again submit drep registration certificate
@@ -1015,7 +1009,7 @@ def test_drep_no_multiple_registration(
10151009
submit_method=submit_method,
10161010
use_build_cmd=use_build_cmd,
10171011
tx_files=tx_files_reg,
1018-
deposit=deposit_amt,
1012+
deposit=reg_drep.deposit,
10191013
)
10201014

10211015
err_msg = str(excinfo.value)

0 commit comments

Comments
 (0)