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

Function test_signup_process_error

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

Source from the content-addressed store, hash-verified

1108
1109 #[test]
1110 fn test_signup_process_error() {
1111 let t = ClientTester::default();
1112 t.get_service().borrow_mut().add_mock_signup(
1113 SignupRequest {
1114 username: "the-username".to_owned(),
1115 password: "theP4ssword".to_owned(),
1116 email: "some@example.com".to_owned(),
1117 promotional_email: false,
1118 },
1119 Err(io::Error::new(io::ErrorKind::AlreadyExists, "Some error")),
1120 );
1121 t.get_console().borrow_mut().set_interactive(true);
1122
1123 let mut t = t
1124 .add_input_chars("the-username\n")
1125 .add_input_chars("theP4ssword\n")
1126 .add_input_chars("theP4ssword\n")
1127 .add_input_chars("some@example.com\n")
1128 .add_input_chars("\n") // Default promotional email answer.
1129 .add_input_chars("true\n"); // Confirmation.
1130 let mut c = t.run("SIGNUP".to_owned());
1131 let output = flatten_output(c.take_captured_out());
1132 c.expect_err("1:1: Some error").check();
1133
1134 assert!(output.contains("Username: the-username"));
1135 assert!(output.contains("Email address: some@example.com"));
1136 assert!(output.contains("Promotional email: no"));
1137 }
1138}

Callers

nothing calls this directly

Calls 10

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
expect_errMethod · 0.45

Tested by

no test coverage detected