()
| 368 | |
| 369 | #[test] |
| 370 | fn no_upload_canister_modules() { |
| 371 | let TestEnv { |
| 372 | env, |
| 373 | canister_ids, |
| 374 | controller, |
| 375 | .. |
| 376 | } = setup_new_env_with_config(SetupConfig { |
| 377 | upload_canister_modules: false, |
| 378 | fallback_controller: None, |
| 379 | start_cycles: None, |
| 380 | ..Default::default() |
| 381 | }); |
| 382 | |
| 383 | let user_id = user_test_id(0); |
| 384 | |
| 385 | // register user |
| 386 | let register_args = RegisterUserInput { station: None }; |
| 387 | let res: (ApiResult<RegisterUserResponse>,) = update_candid_as( |
| 388 | &env, |
| 389 | canister_ids.control_panel, |
| 390 | user_id, |
| 391 | "register_user", |
| 392 | (register_args,), |
| 393 | ) |
| 394 | .unwrap(); |
| 395 | let user_dto = res.0.unwrap().user; |
| 396 | assert_eq!(user_dto.identity, user_id); |
| 397 | |
| 398 | // deploying user station fails before uploading canister modules |
| 399 | let deploy_station_args = DeployStationInput { |
| 400 | name: "station".to_string(), |
| 401 | admins: vec![DeployStationAdminUserInput { |
| 402 | identity: user_id, |
| 403 | username: "admin".to_string(), |
| 404 | }], |
| 405 | associate_with_caller: Some(AssociateWithCallerInput { labels: vec![] }), |
| 406 | subnet_selection: None, |
| 407 | }; |
| 408 | let res: (ApiResult<DeployStationResponse>,) = update_candid_as( |
| 409 | &env, |
| 410 | canister_ids.control_panel, |
| 411 | user_id, |
| 412 | "deploy_station", |
| 413 | (deploy_station_args,), |
| 414 | ) |
| 415 | .unwrap(); |
| 416 | assert!(res |
| 417 | .0 |
| 418 | .unwrap_err() |
| 419 | .message |
| 420 | .unwrap() |
| 421 | .contains("Canister config not initialized")); |
| 422 | |
| 423 | upload_canister_modules(&env, canister_ids.control_panel, controller); |
| 424 | |
| 425 | // deploying user station succeeds after uploading canister modules |
| 426 | let deploy_station_args = DeployStationInput { |
| 427 | name: "station".to_string(), |
nothing calls this directly
no test coverage detected