Skip to content

Commit 116b8a3

Browse files
committed
update pallets- tests
1 parent 340744d commit 116b8a3

File tree

1 file changed

+39
-8
lines changed
  • substrate-node/pallets/pallet-smart-contract/src

1 file changed

+39
-8
lines changed

substrate-node/pallets/pallet-smart-contract/src/tests.rs

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
use frame_support::{
66
assert_noop, assert_ok,
77
dispatch::Pays,
8-
traits::{LockableCurrency, WithdrawReasons},
8+
traits::{Currency, ExistenceRequirement, LockableCurrency, WithdrawReasons},
99
BoundedVec,
1010
};
1111
use frame_system::{EventRecord, Phase, RawOrigin};
@@ -1506,9 +1506,10 @@ fn test_node_contract_billing_cycles_cancel_contract_during_cycle_without_balanc
15061506

15071507
let extrinsic_fee = 10000;
15081508
Balances::transfer(
1509-
RuntimeOrigin::signed(bob()),
1510-
alice(),
1509+
&bob(),
1510+
&alice(),
15111511
initial_twin_balance - total_amount_billed - extrinsic_fee,
1512+
ExistenceRequirement::AllowDeath,
15121513
)
15131514
.unwrap();
15141515

@@ -1641,7 +1642,13 @@ fn test_restore_node_contract_in_grace_works() {
16411642
run_to_block(31, Some(&mut pool_state));
16421643
run_to_block(41, Some(&mut pool_state));
16431644
// Transfer some balance to the owner of the contract to trigger the grace period to stop
1644-
Balances::transfer(RuntimeOrigin::signed(bob()), charlie(), 100000000).unwrap();
1645+
Balances::transfer(
1646+
&bob(),
1647+
&charlie(),
1648+
100000000,
1649+
ExistenceRequirement::AllowDeath,
1650+
)
1651+
.unwrap();
16451652
run_to_block(52, Some(&mut pool_state));
16461653
run_to_block(62, Some(&mut pool_state));
16471654

@@ -1881,7 +1888,13 @@ fn test_rent_contract_billing_cancel_should_bill_reserved_balance() {
18811888
let twin = TfgridModule::twins(2).unwrap();
18821889
let usable_balance = Balances::usable_balance(&twin.account_id);
18831890
assert_ne!(usable_balance, 0);
1884-
Balances::transfer(RuntimeOrigin::signed(bob()), alice(), usable_balance).unwrap();
1891+
Balances::transfer(
1892+
&bob(),
1893+
&alice(),
1894+
usable_balance,
1895+
ExistenceRequirement::AllowDeath,
1896+
)
1897+
.unwrap();
18851898

18861899
// Last amount due is the same as the first one
18871900
assert_ne!(amount_due_as_u128, 0);
@@ -2258,7 +2271,13 @@ fn test_restore_rent_contract_in_grace_works() {
22582271
run_to_block(31, Some(&mut pool_state));
22592272

22602273
// Transfer some balance to the owner of the contract to trigger the grace period to stop
2261-
Balances::transfer(RuntimeOrigin::signed(bob()), charlie(), 100000000).unwrap();
2274+
Balances::transfer(
2275+
&bob(),
2276+
&charlie(),
2277+
100000000,
2278+
ExistenceRequirement::AllowDeath,
2279+
)
2280+
.unwrap();
22622281

22632282
pool_state
22642283
.write()
@@ -2361,7 +2380,13 @@ fn test_restore_rent_contract_and_node_contracts_in_grace_works() {
23612380
run_to_block(32, Some(&mut pool_state));
23622381

23632382
// Transfer some balance to the owner of the contract to trigger the grace period to stop
2364-
Balances::transfer(RuntimeOrigin::signed(bob()), charlie(), 100000000).unwrap();
2383+
Balances::transfer(
2384+
&bob(),
2385+
&charlie(),
2386+
100000000,
2387+
ExistenceRequirement::AllowDeath,
2388+
)
2389+
.unwrap();
23652390

23662391
pool_state
23672392
.write()
@@ -3319,7 +3344,13 @@ fn test_service_contract_bill_out_of_funds_fails() {
33193344
// Drain consumer account
33203345
let consumer_twin = TfgridModule::twins(2).unwrap();
33213346
let consumer_balance = Balances::free_balance(&consumer_twin.account_id);
3322-
Balances::transfer(RuntimeOrigin::signed(bob()), alice(), consumer_balance).unwrap();
3347+
Balances::transfer(
3348+
&bob(),
3349+
&alice(),
3350+
consumer_balance,
3351+
ExistenceRequirement::AllowDeath,
3352+
)
3353+
.unwrap();
33233354
let consumer_balance = Balances::free_balance(&consumer_twin.account_id);
33243355
assert_eq!(consumer_balance, 0);
33253356

0 commit comments

Comments
 (0)