12
12
13
13
import test_tools as tt
14
14
from hive_local_tools .functional .python .operation import (
15
+ generate_large_amount_of_blocks ,
15
16
publish_feeds ,
16
17
)
17
18
20
21
21
22
22
23
@pytest .mark .testnet ()
23
- def test_convert_hbd_to_hive (create_node_and_wallet_for_convert_tests : tuple , alice : ConvertAccount ) -> None :
24
+ def test_convert_hbd_to_hive (
25
+ create_node_and_wallet_for_convert_tests : tuple [tt .InitNode , tt .Wallet ], alice : ConvertAccount
26
+ ) -> None :
24
27
# test case 1 from: https://gitlab.syncad.com/hive/hive/-/issues/478
25
28
node , wallet = create_node_and_wallet_for_convert_tests
26
29
publish_feeds (node , wallet , base = 1000 , quote = 400 )
@@ -35,9 +38,7 @@ def test_convert_hbd_to_hive(create_node_and_wallet_for_convert_tests: tuple, al
35
38
alice .check_if_current_rc_mana_was_reduced (transaction )
36
39
alice .check_if_funds_to_convert_were_subtracted (transaction )
37
40
# generate enough block to jump HIVE_COLLATERALIZED_CONVERSION_DELAY interval
38
- node .api .debug_node .debug_generate_blocks (
39
- debug_key = tt .Account ("initminer" ).private_key , count = 1680 , skip = 0 , miss_blocks = 0 , edit_if_needed = True
40
- )
41
+ generate_large_amount_of_blocks (node = node , block_signer = tt .Account ("initminer" ), count = 1680 )
41
42
alice .check_if_right_amount_was_converted_and_added_to_balance (transaction )
42
43
alice .assert_fill_convert_request_operation (expected_amount = 1 )
43
44
@@ -93,17 +94,13 @@ def test_convert_hbd_to_hive_during_few_days(
93
94
alice .assert_fill_convert_request_operation (expected_amount = vops_counter )
94
95
convert_transactions_it += 1
95
96
96
- node .api .debug_node .debug_generate_blocks (
97
- debug_key = tt .Account ("initminer" ).private_key ,
98
- count = blocks_to_generate ,
99
- skip = 0 ,
100
- miss_blocks = 0 ,
101
- edit_if_needed = True ,
102
- )
97
+ generate_large_amount_of_blocks (node , tt .Account ("initminer" ), count = blocks_to_generate )
103
98
104
99
105
100
@pytest .mark .testnet ()
106
- def test_convert_hive_to_hbd (create_node_and_wallet_for_convert_tests : tuple , alice : ConvertAccount ) -> None :
101
+ def test_convert_hive_to_hbd (
102
+ create_node_and_wallet_for_convert_tests : tuple [tt .InitNode , tt .Wallet ], alice : ConvertAccount
103
+ ) -> None :
107
104
# test case 1 from: https://gitlab.syncad.com/hive/hive/-/issues/481
108
105
node , wallet = create_node_and_wallet_for_convert_tests
109
106
publish_feeds (node , wallet , base = 1000 , quote = 400 )
@@ -123,9 +120,7 @@ def test_convert_hive_to_hbd(create_node_and_wallet_for_convert_tests: tuple, al
123
120
alice .assert_collateralized_conversion_requests (trx = transaction , state = "create" )
124
121
125
122
# generate enough blocks to jump HIVE_COLLATERALIZED_CONVERSION_DELAY interval
126
- node .api .debug_node .debug_generate_blocks (
127
- debug_key = tt .Account ("initminer" ).private_key , count = 1680 , skip = 0 , miss_blocks = 0 , edit_if_needed = True
128
- )
123
+ generate_large_amount_of_blocks (node = node , block_signer = tt .Account ("initminer" ), count = 1680 )
129
124
alice .assert_if_right_amount_of_hives_came_back_after_collateral_conversion (transaction )
130
125
alice .assert_collateralized_conversion_requests (trx = transaction , state = "delete" )
131
126
alice .assert_fill_collateralized_convert_request_operation (expected_amount = 1 )
@@ -185,13 +180,7 @@ def test_convert_hive_to_hbd_during_few_days(
185
180
)
186
181
alice .assert_fill_collateralized_convert_request_operation (expected_amount = vops_counter )
187
182
convert_transactions_it += 1
188
- node .api .debug_node .debug_generate_blocks (
189
- debug_key = tt .Account ("initminer" ).private_key ,
190
- count = blocks_to_generate ,
191
- skip = 0 ,
192
- miss_blocks = 0 ,
193
- edit_if_needed = True ,
194
- )
183
+ generate_large_amount_of_blocks (node , tt .Account ("initminer" ), count = blocks_to_generate )
195
184
196
185
197
186
@pytest .mark .parametrize (
@@ -221,7 +210,7 @@ def test_convert_hive_to_hbd_during_few_days(
221
210
],
222
211
)
223
212
def test_convert_hive_into_hbd_with_changing_median_current_price_during_conversion (
224
- create_node_and_wallet_for_convert_tests : tuple ,
213
+ create_node_and_wallet_for_convert_tests : tuple [ tt . InitNode , tt . Wallet ] ,
225
214
alice : ConvertAccount ,
226
215
initial_feed_base_value : int ,
227
216
further_feed_base_value : int ,
@@ -242,9 +231,7 @@ def test_convert_hive_into_hbd_with_changing_median_current_price_during_convers
242
231
publish_feeds (node , wallet , further_feed_base_value , 1000 )
243
232
244
233
# generate enough block to jump HIVE_COLLATERALIZED_CONVERSION_DELAY interval
245
- node .api .debug_node .debug_generate_blocks (
246
- debug_key = tt .Account ("initminer" ).private_key , count = 1680 , skip = 0 , miss_blocks = 0 , edit_if_needed = True
247
- )
234
+ generate_large_amount_of_blocks (node = node , block_signer = tt .Account ("initminer" ), count = 1680 )
248
235
alice .assert_if_right_amount_of_hives_came_back_after_collateral_conversion (transaction )
249
236
alice .assert_collateralized_conversion_requests (trx = transaction , state = "delete" )
250
237
alice .assert_fill_collateralized_convert_request_operation (expected_amount = 1 )
@@ -258,7 +245,9 @@ def test_convert_hive_into_hbd_with_changing_median_current_price_during_convers
258
245
],
259
246
)
260
247
def test_minimal_feed_price_greater_than_median_feed_price (
261
- create_node_and_wallet_for_convert_tests : tuple , alice : ConvertAccount , feed_base_values : tuple
248
+ create_node_and_wallet_for_convert_tests : tuple [tt .InitNode , tt .Wallet ],
249
+ alice : ConvertAccount ,
250
+ feed_base_values : tuple ,
262
251
) -> None :
263
252
# test case from Excel file (sheet TC2 - columns D, F) https://gitlab.syncad.com/hive/hive/-/issues/481#note_154312
264
253
node , wallet = create_node_and_wallet_for_convert_tests
@@ -301,13 +290,7 @@ def test_minimal_feed_price_greater_than_median_feed_price(
301
290
trx = publish_feeds (node , wallet , next (feeds_it ), 1000 , broadcast = False )
302
291
node .api .network_broadcast .broadcast_transaction (trx = trx )
303
292
304
- node .api .debug_node .debug_generate_blocks (
305
- debug_key = tt .Account ("initminer" ).private_key ,
306
- count = blocks_to_generate ,
307
- skip = 0 ,
308
- miss_blocks = 0 ,
309
- edit_if_needed = True ,
310
- )
293
+ generate_large_amount_of_blocks (node = node , block_signer = tt .Account ("initminer" ), count = blocks_to_generate )
311
294
312
295
313
296
@pytest .mark .parametrize (
@@ -318,7 +301,9 @@ def test_minimal_feed_price_greater_than_median_feed_price(
318
301
],
319
302
)
320
303
def test_median_feed_price_greater_than_minimal_feed_price (
321
- create_node_and_wallet_for_convert_tests : tuple , alice : ConvertAccount , feed_base_values : tuple
304
+ create_node_and_wallet_for_convert_tests : tuple [tt .InitNode , tt .Wallet ],
305
+ alice : ConvertAccount ,
306
+ feed_base_values : tuple ,
322
307
) -> None :
323
308
# test case from Excel file (sheet TC2 - columns C, E) https://gitlab.syncad.com/hive/hive/-/issues/481#note_154312
324
309
node , wallet = create_node_and_wallet_for_convert_tests
@@ -363,10 +348,4 @@ def test_median_feed_price_greater_than_minimal_feed_price(
363
348
alice .assert_fill_collateralized_convert_request_operation (expected_amount = vops_counter )
364
349
convert_transactions_it += 1
365
350
366
- node .api .debug_node .debug_generate_blocks (
367
- debug_key = tt .Account ("initminer" ).private_key ,
368
- count = blocks_to_generate ,
369
- skip = 0 ,
370
- miss_blocks = 0 ,
371
- edit_if_needed = True ,
372
- )
351
+ generate_large_amount_of_blocks (node = node , block_signer = tt .Account ("initminer" ), count = blocks_to_generate )
0 commit comments