File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -693,6 +693,33 @@ fn add_proxy_success_creates_proxy_relationship() {
693693 } ) ;
694694}
695695
696+ #[ test]
697+ fn remove_proxy_success_removes_proxy_relationship ( ) {
698+ mock:: new_test_ext ( 1 ) . execute_with ( || {
699+ let delegator = U256 :: from ( 7001 ) ;
700+ let delegate = U256 :: from ( 7002 ) ;
701+
702+ pallet_subtensor:: Pallet :: < mock:: Test > :: add_balance_to_coldkey_account (
703+ & delegator,
704+ 1_000_000_000 ,
705+ ) ;
706+
707+ let mut add_env = MockEnv :: new ( FunctionId :: AddProxyV1 , delegator, delegate. encode ( ) ) ;
708+ let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut add_env) . unwrap ( ) ;
709+ assert_success ( ret) ;
710+
711+ let proxies_before = pallet_subtensor_proxy:: Proxies :: < mock:: Test > :: get ( delegator) . 0 ;
712+ assert_eq ! ( proxies_before. len( ) , 1 ) ;
713+
714+ let mut remove_env = MockEnv :: new ( FunctionId :: RemoveProxyV1 , delegator, delegate. encode ( ) ) ;
715+ let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut remove_env) . unwrap ( ) ;
716+ assert_success ( ret) ;
717+
718+ let proxies_after = pallet_subtensor_proxy:: Proxies :: < mock:: Test > :: get ( delegator) . 0 ;
719+ assert_eq ! ( proxies_after. len( ) , 0 ) ;
720+ } ) ;
721+ }
722+
696723impl MockEnv {
697724 fn new ( func_id : FunctionId , caller : AccountId , input : Vec < u8 > ) -> Self {
698725 Self {
You can’t perform that action at this time.
0 commit comments