@@ -84,3 +84,40 @@ pub mod error {
8484 }
8585 }
8686}
87+
88+ #[ test]
89+ fn test_pause_control ( ) {
90+ use crate :: connector_impl:: EthConnector ;
91+
92+ let mut connector = EthConnector {
93+ prover_account : "prover" . parse ( ) . unwrap ( ) ,
94+ eth_custodian_address : Default :: default ( ) ,
95+ paused_mask : UNPAUSE_ALL ,
96+ account_with_access_right : "aurora" . parse ( ) . unwrap ( ) ,
97+ owner_id : "aurora" . parse ( ) . unwrap ( ) ,
98+ } ;
99+
100+ assert ! ( connector. assert_not_paused( PAUSE_DEPOSIT ) . is_ok( ) ) ;
101+ assert ! ( connector. assert_not_paused( PAUSE_WITHDRAW ) . is_ok( ) ) ;
102+
103+ connector. set_paused_flags ( PAUSE_DEPOSIT ) ;
104+
105+ assert ! ( connector. assert_not_paused( PAUSE_DEPOSIT ) . is_err( ) ) ;
106+ assert ! ( connector. assert_not_paused( PAUSE_WITHDRAW ) . is_ok( ) ) ;
107+
108+ connector. set_paused_flags ( UNPAUSE_ALL ) ;
109+ connector. set_paused_flags ( PAUSE_WITHDRAW ) ;
110+
111+ assert ! ( connector. assert_not_paused( PAUSE_DEPOSIT ) . is_ok( ) ) ;
112+ assert ! ( connector. assert_not_paused( PAUSE_WITHDRAW ) . is_err( ) ) ;
113+
114+ connector. set_paused_flags ( PAUSE_WITHDRAW | PAUSE_DEPOSIT ) ;
115+
116+ assert ! ( connector. assert_not_paused( PAUSE_DEPOSIT ) . is_err( ) ) ;
117+ assert ! ( connector. assert_not_paused( PAUSE_WITHDRAW ) . is_err( ) ) ;
118+
119+ connector. set_paused_flags ( UNPAUSE_ALL ) ;
120+
121+ assert ! ( connector. assert_not_paused( PAUSE_DEPOSIT ) . is_ok( ) ) ;
122+ assert ! ( connector. assert_not_paused( PAUSE_WITHDRAW ) . is_ok( ) ) ;
123+ }
0 commit comments