File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
pallets/capacity/src/tests Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
use super :: mock:: * ;
2
2
use frame_support:: { assert_ok, traits:: Hooks } ;
3
3
4
+ use common_primitives:: capacity:: StakingType ;
4
5
#[ allow( unused) ]
5
6
use sp_runtime:: traits:: SignedExtension ;
6
7
@@ -89,3 +90,23 @@ pub fn setup_provider(
89
90
assert_eq ! ( account_staking_type, staking_type) ;
90
91
}
91
92
}
93
+ pub fn setup_provider (
94
+ staker : & u64 ,
95
+ target : & MessageSourceId ,
96
+ amount : & u64 ,
97
+ staking_type : StakingType ,
98
+ ) {
99
+ let provider_name = String :: from ( "Cst-" ) + target. to_string ( ) . as_str ( ) ;
100
+ register_provider ( * target, provider_name) ;
101
+ if amount. gt ( & 0u64 ) {
102
+ assert_ok ! ( Capacity :: stake(
103
+ RuntimeOrigin :: signed( staker. clone( ) ) ,
104
+ * target,
105
+ * amount,
106
+ staking_type. clone( )
107
+ ) ) ;
108
+ let target = Capacity :: get_target_for ( staker, target) . unwrap ( ) ;
109
+ assert_eq ! ( target. amount, * amount) ;
110
+ assert_eq ! ( target. staking_type, staking_type) ;
111
+ }
112
+ }
You can’t perform that action at this time.
0 commit comments