From 9582c34635fd8769fed501c3ef5d7de157c76776 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 14 Dec 2022 08:55:52 +0100 Subject: [PATCH] test: Pausable `except` works when `ALL` is paused --- near-plugins/src/pausable.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/near-plugins/src/pausable.rs b/near-plugins/src/pausable.rs index c3beb03..f215e5a 100644 --- a/near-plugins/src/pausable.rs +++ b/near-plugins/src/pausable.rs @@ -299,6 +299,23 @@ mod tests { assert_eq!(counter.counter, 0); } + /// Verify `except` escape hatch works when the feature is paused via `ALL`. + #[test] + fn test_pause_with_all_allows_except() { + let (mut counter, mut ctx) = setup_basic(); + + // Pause `ALL`. + ctx.predecessor_account_id = "anna.test".to_string().try_into().unwrap(); + testing_env!(ctx.clone()); + counter.pa_pause_feature("ALL".to_string()); + + // Call paused function from exempted account. + ctx.predecessor_account_id = "brenda.test".to_string().try_into().unwrap(); + testing_env!(ctx.clone()); + counter.increase_4(); + assert_eq!(counter.counter, 4); + } + #[test] fn test_not_paused_with_different_key() { let (mut counter, mut ctx) = setup_basic();