Skip to content

Commit 9d890d1

Browse files
This PR refactors test_node_upgrade.py
1 parent 5f5bec3 commit 9d890d1

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

cardano_node_tests/tests/test_node_upgrade.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,17 @@ def test_hardfork(
321321
)
322322

323323

324+
def _get_build_str(build_method: str) -> str:
325+
if build_method == clusterlib_utils.BuildMethods.BUILD:
326+
return "build"
327+
if build_method == clusterlib_utils.BuildMethods.BUILD_RAW:
328+
return "build_raw"
329+
if build_method == clusterlib_utils.BuildMethods.BUILD_EST:
330+
return "build_estimate"
331+
msg = f"Unsupported build method: {build_method}"
332+
raise ValueError(msg)
333+
334+
324335
class TestUpgrade:
325336
"""Tests for node upgrade testing."""
326337

@@ -364,13 +375,7 @@ def test_prepare_tx(
364375
be submitted in next node version and/or next era.
365376
"""
366377
temp_template = common.get_test_id(cluster)
367-
build_str = (
368-
"build"
369-
if build_method == clusterlib_utils.BuildMethods.BUILD
370-
else "build_raw"
371-
if build_method == clusterlib_utils.BuildMethods.BUILD_RAW
372-
else "build_estimate"
373-
)
378+
build_str = _get_build_str(build_method)
374379

375380
src_address = payment_addrs_disposable[0].address
376381
dst_address = payment_addrs_disposable[1].address
@@ -487,13 +492,7 @@ def test_submit_tx(
487492
):
488493
"""Submit transaction that was created by previous node version and/or in previous era."""
489494
temp_template = common.get_test_id(cluster)
490-
build_str = (
491-
"build"
492-
if build_method == clusterlib_utils.BuildMethods.BUILD
493-
else "build_raw"
494-
if build_method == clusterlib_utils.BuildMethods.BUILD_RAW
495-
else "build_estimate"
496-
)
495+
build_str = _get_build_str(build_method)
497496

498497
tx_dir = (
499498
temptools.get_basetemp()

0 commit comments

Comments
 (0)