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

Function test_signup_ok_retry_inputs

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

Source from the content-addressed store, hash-verified

1041
1042 #[test]
1043 fn test_signup_ok_retry_inputs() {
1044 let t = ClientTester::default();
1045 t.get_service().borrow_mut().add_mock_signup(
1046 SignupRequest {
1047 username: "the-username".to_owned(),
1048 password: "AnotherPassword7".to_owned(),
1049 email: "some@example.com".to_owned(),
1050 promotional_email: false,
1051 },
1052 Ok(()),
1053 );
1054 t.get_console().borrow_mut().set_interactive(true);
1055
1056 let mut t = t
1057 .add_input_chars("the-username\n")
1058 .add_input_chars("too simple\n") // Password complexity failure.
1059 .add_input_chars("123456\n") // Password complexity failure.
1060 .add_input_chars("AnotherPassword7\n")
1061 .add_input_chars("does not match\n") // Second password doesn't match.
1062 .add_input_chars("too simple\n") // Password complexity failure.
1063 .add_input_chars("123456\n") // Password complexity failure.
1064 .add_input_chars("AnotherPassword7\n")
1065 .add_input_chars("AnotherPassword7\n")
1066 .add_input_chars("some@example.com\n")
1067 .add_input_chars("123\n") // Promotional email answer failure.
1068 .add_input_chars("n\n") // Promotional email answer.
1069 .add_input_chars("foo\n") // Confirmation failure.
1070 .add_input_chars("y\n"); // Confirmation.
1071 let mut c = t.run("SIGNUP".to_owned());
1072 let output = flatten_output(c.take_captured_out());
1073 c.check();
1074
1075 assert!(output.contains("Invalid input"));
1076 assert!(output.contains("Invalid password: Must contain"));
1077 assert!(output.contains("Passwords do not match"));
1078 assert!(output.contains("Username: the-username"));
1079 assert!(output.contains("Email address: some@example.com"));
1080 assert!(output.contains("Promotional email: no"));
1081 }
1082
1083 #[test]
1084 fn test_signup_abort() {

Callers

nothing calls this directly

Calls 9

flatten_outputFunction · 0.85
add_mock_signupMethod · 0.80
get_serviceMethod · 0.80
set_interactiveMethod · 0.80
get_consoleMethod · 0.45
add_input_charsMethod · 0.45
runMethod · 0.45
take_captured_outMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected