Complete TUI coverage and security audit
This commit is contained in:
@@ -37,6 +37,7 @@ pub enum AuthenticationTarget {
|
||||
Workflow(Box<WorkflowSubmission>),
|
||||
Git(ironstorage::command::GitRequest),
|
||||
Otp(crate::app::OtpUiRequest),
|
||||
Show(ironstorage::command::ShowRequest),
|
||||
}
|
||||
|
||||
struct AuthenticationCompletion {
|
||||
@@ -89,6 +90,10 @@ impl AuthenticationCoordinator {
|
||||
self.request(AuthenticationTarget::Otp(request));
|
||||
}
|
||||
|
||||
pub fn request_show(&mut self, request: ironstorage::command::ShowRequest) {
|
||||
self.request(AuthenticationTarget::Show(request));
|
||||
}
|
||||
|
||||
fn request(&mut self, target: AuthenticationTarget) {
|
||||
self.generation = self.generation.wrapping_add(1);
|
||||
let generation = self.generation;
|
||||
@@ -259,4 +264,28 @@ mod tests {
|
||||
.expect("worker should return a typed result");
|
||||
assert_eq!(app.apply_result(result), ResultDisposition::Applied);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blocked_storage_work_never_blocks_interaction_state() {
|
||||
let executor = AsyncExecutor::new();
|
||||
let mut app = App::new();
|
||||
let token = app.begin_request();
|
||||
let (release, blocked) = std::sync::mpsc::channel();
|
||||
executor.submit(token, move || {
|
||||
blocked.recv().expect("release slow storage");
|
||||
Err("slow result".to_owned())
|
||||
});
|
||||
|
||||
app.resize(60, 12);
|
||||
app.tick();
|
||||
assert!(app.transition(crate::app::Transition::OpenHelp));
|
||||
assert_eq!(app.mode(), crate::app::Mode::Help);
|
||||
|
||||
release.send(()).expect("release worker");
|
||||
let result = executor
|
||||
.receiver
|
||||
.recv_timeout(Duration::from_secs(2))
|
||||
.expect("worker result");
|
||||
assert_eq!(app.apply_result(result), ResultDisposition::Applied);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user