1- """Tests for governance functionality.
1+ """Tests for old pre-Conway governance functionality.
22
33Tests for update proposals are in separate file `test_update_proposals.py`.
44
2525from cardano_node_tests .utils import helpers
2626from cardano_node_tests .utils import poll_utils
2727from cardano_node_tests .utils import tx_view
28- from cardano_node_tests .utils .versions import VERSIONS
2928
3029LOGGER = logging .getLogger (__name__ )
3130DATA_DIR = pl .Path (__file__ ).parent / "data"
3231
33- pytestmark = pytest .mark .skipif (
34- VERSIONS .transaction_era != VERSIONS .BABBAGE ,
35- reason = "legacy SPO polls work only with Babbage Tx era" ,
36- )
37-
3832
3933class TestPoll :
40- """Tests for SPO poll."""
34+ """Tests for old pre-Conway SPO poll."""
4135
4236 @pytest .fixture (scope = "class" )
4337 def governance_poll_available (self ) -> None :
4438 if not clusterlib_utils .cli_has ("babbage governance create-poll" ):
45- pytest .skip ("The `cardano-cli governance` poll commands are not available." )
39+ pytest .fail (
40+ "The `cardano-cli babbage governance` poll commands are no longer available."
41+ )
4642
4743 @pytest .fixture
4844 def payment_addr (
@@ -58,7 +54,7 @@ def payment_addr(
5854 cluster_obj = cluster ,
5955 )[0 ]
6056
61- # fund source address
57+ # Fund source address
6258 clusterlib_utils .fund_from_faucet (
6359 addr ,
6460 cluster_obj = cluster ,
@@ -128,30 +124,16 @@ def test_create_and_answer_poll(
128124 metadata_json_detailed_schema = True ,
129125 )
130126
131- if use_build_cmd :
132- tx_output_poll = cluster .g_transaction .build_tx (
133- src_address = payment_addr .address ,
134- tx_name = f"{ temp_template } _poll" ,
135- tx_files = tx_files_poll ,
136- witness_override = len (tx_files_poll .signing_key_files ),
137- required_signers = required_signers_arg ,
138- required_signer_hashes = required_signers_vkey_hash_arg ,
139- )
140-
141- tx_signed_poll = cluster .g_transaction .sign_tx (
142- tx_body_file = tx_output_poll .out_file ,
143- signing_key_files = tx_files_poll .signing_key_files ,
144- tx_name = f"{ temp_template } _poll" ,
145- )
146- cluster .g_transaction .submit_tx (tx_file = tx_signed_poll , txins = tx_output_poll .txins )
147- else :
148- tx_output_poll = cluster .g_transaction .send_tx (
149- src_address = payment_addr .address ,
150- tx_name = f"{ temp_template } _poll" ,
151- tx_files = tx_files_poll ,
152- required_signers = required_signers_arg ,
153- required_signer_hashes = required_signers_vkey_hash_arg ,
154- )
127+ tx_output_poll = clusterlib_utils .build_and_submit_tx (
128+ cluster_obj = cluster ,
129+ name_template = f"{ temp_template } _poll" ,
130+ src_address = payment_addr .address ,
131+ use_build_cmd = use_build_cmd ,
132+ tx_files = tx_files_poll ,
133+ required_signers = required_signers_arg ,
134+ required_signer_hashes = required_signers_vkey_hash_arg ,
135+ witness_override = len (tx_files_poll .signing_key_files ),
136+ )
155137
156138 expected_metadata = {"94" : [[0 , [poll_question ]], [1 , [["Yes" ], ["No" ]]]]}
157139
@@ -189,27 +171,15 @@ def test_create_and_answer_poll(
189171 metadata_json_detailed_schema = True ,
190172 )
191173
192- if use_build_cmd :
193- tx_output_answer = cluster .g_transaction .build_tx (
194- src_address = payment_addr .address ,
195- tx_name = f"{ temp_template } _answer" ,
196- tx_files = tx_files_answer ,
197- required_signers = [node_cold .skey_file ],
198- witness_override = len (tx_files_answer .signing_key_files ),
199- )
200- tx_signed_answer = cluster .g_transaction .sign_tx (
201- tx_body_file = tx_output_answer .out_file ,
202- signing_key_files = tx_files_answer .signing_key_files ,
203- tx_name = f"{ temp_template } _answer" ,
204- )
205- cluster .g_transaction .submit_tx (tx_file = tx_signed_answer , txins = tx_output_answer .txins )
206- else :
207- tx_output_answer = cluster .g_transaction .send_tx (
208- src_address = payment_addr .address ,
209- tx_name = f"{ temp_template } _answer" ,
210- tx_files = tx_files_answer ,
211- required_signers = [node_cold .skey_file ],
212- )
174+ tx_output_answer = clusterlib_utils .build_and_submit_tx (
175+ cluster_obj = cluster ,
176+ name_template = f"{ temp_template } _answer" ,
177+ src_address = payment_addr .address ,
178+ use_build_cmd = use_build_cmd ,
179+ tx_files = tx_files_answer ,
180+ required_signers = [node_cold .skey_file ],
181+ witness_override = len (tx_files_answer .signing_key_files ),
182+ )
213183
214184 out_utxos_answer = cluster .g_query .get_utxo (tx_raw_output = tx_output_answer )
215185 assert (
@@ -327,7 +297,11 @@ def test_create_invalid_answer(
327297 )
328298
329299 err_str = str (excinfo .value )
330- assert "Poll answer out of bounds" in err_str or "negative index" in err_str , err_str
300+ assert (
301+ "Poll answer out of bounds" in err_str
302+ or "negative index" in err_str
303+ or 'unexpected "-"' in err_str
304+ ), err_str
331305
332306 @allure .link (helpers .get_vcs_link ())
333307 @pytest .mark .smoke
@@ -353,7 +327,11 @@ def test_create_answer_negative_index(
353327 )
354328
355329 err_str = str (excinfo .value )
356- assert "Poll answer out of bounds" in err_str or "negative index" in err_str , err_str
330+ assert (
331+ "Poll answer out of bounds" in err_str
332+ or "negative index" in err_str
333+ or 'unexpected "-"' in err_str
334+ ), err_str
357335
358336 if "Prelude.!!" in err_str :
359337 issues .dbsync_1363 .finish_test ()
0 commit comments