Skip to content

Commit 9abc838

Browse files
use mock_auths instead of mock_all_auths in test
1 parent 63ea6b1 commit 9abc838

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

soroban-sdk/src/_migrating/v25_contracttrait.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,33 @@
211211
//! # }
212212
//! # #[cfg(feature = "testutils")]
213213
//! # fn main() {
214-
//! use soroban_sdk::testutils::Address as _;
214+
//! use soroban_sdk::{testutils::{Address as _, MockAuth, MockAuthInvoke}, IntoVal};
215215
//! let env = Env::default();
216-
//! env.mock_all_auths();
217216
//! let admin = Address::generate(&env);
218217
//! let contract_id = env.register(MyContract, (&admin,));
219218
//! let client = PausableClient::new(&env, &contract_id);
220219
//!
220+
//! let mock_admin = MockAuth {
221+
//! address: &admin,
222+
//! invoke: &MockAuthInvoke {
223+
//! contract: &contract_id,
224+
//! fn_name: "pause",
225+
//! args: ().into_val(&env),
226+
//! sub_invokes: &[],
227+
//! },
228+
//! };
221229
//! assert!(!client.is_paused());
222-
//! client.pause();
230+
//! client.mock_auths(&[mock_admin]).pause();
223231
//! assert!(client.is_paused());
224-
//! client.unpause();
232+
//! client.mock_auths(&[MockAuth {
233+
//! address: &admin,
234+
//! invoke: &MockAuthInvoke {
235+
//! contract: &contract_id,
236+
//! fn_name: "unpause",
237+
//! args: ().into_val(&env),
238+
//! sub_invokes: &[],
239+
//! },
240+
//! }]).unpause();
225241
//! assert!(!client.is_paused());
226242
//! }
227243
//! # #[cfg(not(feature = "testutils"))]

0 commit comments

Comments
 (0)