MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_login_ok_ask_password

Function test_login_ok_ask_password

client/src/cmds.rs:642–668  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 12

add_mock_loginMethod · 0.80
get_serviceMethod · 0.80
set_interactiveMethod · 0.80
pushMethod · 0.80
expect_access_tokenMethod · 0.80
get_storageMethod · 0.45
get_consoleMethod · 0.45
lenMethod · 0.45
checkMethod · 0.45
expect_outputMethod · 0.45
runMethod · 0.45
add_input_charsMethod · 0.45

Tested by

no test coverage detected