()
| 640 | |
| 641 | #[test] |
| 642 | fn test_login_ok_ask_password() { |
| 643 | let t = ClientTester::default(); |
| 644 | t.get_service().borrow_mut().add_mock_login( |
| 645 | "the-username", |
| 646 | "the-password", |
| 647 | Ok(LoginResponse { access_token: AccessToken::new("random token"), motd: vec![] }), |
| 648 | ); |
| 649 | let storage = t.get_storage(); |
| 650 | assert!(!storage.borrow().mounted().contains_key("CLOUD")); |
| 651 | |
| 652 | t.get_console().borrow_mut().set_interactive(true); |
| 653 | let mut exp_output = |
| 654 | vec![CapturedOut::Write("Password: ".to_string()), CapturedOut::SyncNow]; |
| 655 | for _ in 0.."the-password".len() { |
| 656 | exp_output.push(CapturedOut::Write("*".to_string())); |
| 657 | } |
| 658 | exp_output.push(CapturedOut::Print("".to_owned())); |
| 659 | |
| 660 | t.add_input_chars("the-password") |
| 661 | .add_input_chars("\n") |
| 662 | .run(format!(r#"LOGIN "{}""#, "the-username")) |
| 663 | .expect_access_token("random token") |
| 664 | .expect_output(exp_output) |
| 665 | .check(); |
| 666 | |
| 667 | assert!(storage.borrow().mounted().contains_key("CLOUD")); |
| 668 | } |
| 669 | |
| 670 | #[test] |
| 671 | fn test_login_skip_motd_on_narrow_console() { |
nothing calls this directly
no test coverage detected