@@ -18,7 +18,10 @@ use ic_system_test_driver::driver::{
1818} ;
1919use ic_system_test_driver:: nns:: set_authorized_subnetwork_list;
2020use ic_system_test_driver:: sns_client:: add_subnet_to_sns_deploy_whitelist;
21- use ic_system_test_driver:: util:: delegations:: build_internet_identity_backend_install_arg;
21+ use ic_system_test_driver:: util:: delegations:: {
22+ DummyAuthConfig , build_dummy_internet_identity_backend_install_arg,
23+ build_internet_identity_backend_install_arg,
24+ } ;
2225use ic_system_test_driver:: util:: { block_on, create_canister, install_canister, runtime_from_url} ;
2326use icp_ledger:: AccountIdentifier ;
2427use serde:: { Deserialize , Serialize } ;
@@ -117,23 +120,54 @@ struct InternetIdentityFrontendInitArgs {
117120 related_origins : Option < Vec < String > > ,
118121 fetch_root_key : Option < bool > ,
119122 dev_csp : Option < bool > ,
123+ dummy_auth : Option < Option < DummyAuthConfig > > ,
124+ }
125+
126+ pub fn install_ii_canisters (
127+ env : & TestEnv ,
128+ node : & IcNodeSnapshot ,
129+ ic_gateway_domain : & str ,
130+ ) -> ( Principal , Principal ) {
131+ install_ii_canisters_inner ( env, node, ic_gateway_domain, false )
132+ }
133+
134+ pub fn install_dummy_ii_canisters (
135+ env : & TestEnv ,
136+ node : & IcNodeSnapshot ,
137+ ic_gateway_domain : & str ,
138+ ) -> ( Principal , Principal ) {
139+ install_ii_canisters_inner ( env, node, ic_gateway_domain, true )
120140}
121141
122- fn install_ii_canisters (
142+ fn install_ii_canisters_inner (
123143 env : & TestEnv ,
124144 node : & IcNodeSnapshot ,
125145 ic_gateway_domain : & str ,
146+ dummy_auth : bool ,
126147) -> ( Principal , Principal ) {
148+ let backend_install_arg = if dummy_auth {
149+ build_dummy_internet_identity_backend_install_arg ( )
150+ } else {
151+ build_internet_identity_backend_install_arg ( )
152+ } ;
127153 let backend_canister_id = node. create_and_install_canister_with_arg (
128154 & env:: var ( "II_BACKEND_WASM_PATH" ) . expect ( "II_BACKEND_WASM_PATH not set" ) ,
129- Some ( build_internet_identity_backend_install_arg ( ) ) ,
155+ Some ( backend_install_arg ) ,
130156 ) ;
131157
132158 // Create the II frontend canister first to get its canister ID
133159 let agent = node. build_default_agent ( ) ;
134160 let frontend_canister_id =
135161 block_on ( async { create_canister ( & agent, node. effective_canister_id ( ) ) . await } ) ;
136162
163+ let dummy_auth_config = if dummy_auth {
164+ Some ( Some ( DummyAuthConfig {
165+ prompt_for_index : true ,
166+ } ) )
167+ } else {
168+ None
169+ } ;
170+
137171 // Install code into the II frontend canister.
138172 let frontend_wasm =
139173 load_wasm ( env:: var ( "II_FRONTEND_WASM_PATH" ) . expect ( "II_FRONTEND_WASM_PATH not set" ) ) ;
@@ -145,6 +179,7 @@ fn install_ii_canisters(
145179 ) ] ) ,
146180 fetch_root_key: Some ( true ) ,
147181 dev_csp: Some ( true ) ,
182+ dummy_auth: dummy_auth_config,
148183 } )
149184 . unwrap ( ) ;
150185 let logger = env. logger ( ) ;
@@ -176,13 +211,41 @@ pub fn install_ii_nns_dapp_and_subnet_rental(
176211 env : & TestEnv ,
177212 ic_gateway_url : & Url ,
178213 sns_aggregator_canister_id : Option < Principal > ,
214+ ) -> ( Principal , Principal ) {
215+ install_ii_nns_dapp_and_subnet_rental_impl (
216+ env,
217+ ic_gateway_url,
218+ sns_aggregator_canister_id,
219+ false ,
220+ )
221+ }
222+
223+ pub fn install_ii_nns_dapp_and_subnet_rental_with_dummy_auth (
224+ env : & TestEnv ,
225+ ic_gateway_url : & Url ,
226+ sns_aggregator_canister_id : Option < Principal > ,
227+ ) -> ( Principal , Principal ) {
228+ install_ii_nns_dapp_and_subnet_rental_impl (
229+ env,
230+ ic_gateway_url,
231+ sns_aggregator_canister_id,
232+ true ,
233+ )
234+ }
235+
236+ fn install_ii_nns_dapp_and_subnet_rental_impl (
237+ env : & TestEnv ,
238+ ic_gateway_url : & Url ,
239+ sns_aggregator_canister_id : Option < Principal > ,
240+ dummy_auth : bool ,
179241) -> ( Principal , Principal ) {
180242 let ic_gateway_domain = ic_gateway_url. domain ( ) . unwrap ( ) . to_string ( ) ;
181243
182244 // deploy the II canister
183245 let topology = env. topology_snapshot ( ) ;
184246 let nns_node = topology. root_subnet ( ) . nodes ( ) . next ( ) . unwrap ( ) ;
185- let ( _, ii_canister_id) = install_ii_canisters ( env, & nns_node, & ic_gateway_domain) ;
247+ let ( _, ii_canister_id) =
248+ install_ii_canisters_inner ( env, & nns_node, & ic_gateway_domain, dummy_auth) ;
186249
187250 // create the NNS dapp canister so that its canister ID is allocated
188251 // and the Subnet Rental Canister gets its mainnet canister ID in the next step
0 commit comments