test(tui): cover username directories setting and regenerate openrpc doc

This commit is contained in:
Maik Steiger
2026-10-08 22:07:13 +02:00
parent e567fa75ed
commit 5e979a7425
5 changed files with 10 additions and 0 deletions
+4
View File
@@ -240,6 +240,9 @@
"minimum": 0, "minimum": 0,
"type": "integer" "type": "integer"
}, },
"use_username_dirs": {
"type": "boolean"
},
"username": { "username": {
"type": "string" "type": "string"
} }
@@ -250,6 +253,7 @@
"token", "token",
"size", "size",
"download_directory", "download_directory",
"use_username_dirs",
"status" "status"
], ],
"type": "object" "type": "object"
+3
View File
@@ -509,6 +509,7 @@ mod tests {
s.rows(), s.rows(),
vec![ vec![
SettingsRow::ChangePassword, SettingsRow::ChangePassword,
SettingsRow::UseUsernameDirs,
SettingsRow::DownloadDir, SettingsRow::DownloadDir,
SettingsRow::Share(0), SettingsRow::Share(0),
] ]
@@ -516,6 +517,8 @@ mod tests {
// The row below "change password" is the download folder, not a // The row below "change password" is the download folder, not a
// logout the window cannot perform. // logout the window cannot perform.
s.handle_key(key(KeyCode::Down)); s.handle_key(key(KeyCode::Down));
assert_eq!(s.selected_row(), SettingsRow::UseUsernameDirs);
s.handle_key(key(KeyCode::Down));
assert_eq!(s.selected_row(), SettingsRow::DownloadDir); assert_eq!(s.selected_row(), SettingsRow::DownloadDir);
} }
} }
@@ -192,6 +192,7 @@ fn an_attached_window_offers_no_logout() {
let mut tui = attach(session); let mut tui = attach(session);
press(&mut tui, KeyCode::Char('o')); press(&mut tui, KeyCode::Char('o'));
press(&mut tui, KeyCode::Down); press(&mut tui, KeyCode::Down);
press(&mut tui, KeyCode::Down);
press(&mut tui, KeyCode::Enter); press(&mut tui, KeyCode::Enter);
let settings = tui.state.settings.as_ref().expect("still open"); let settings = tui.state.settings.as_ref().expect("still open");
+1
View File
@@ -17,6 +17,7 @@ fn download_entry(filename: &str, status: DownloadStatus) -> DownloadEntry {
token: 1, token: 1,
size: 1000, size: 1000,
download_directory: "/music".into(), download_directory: "/music".into(),
use_username_dirs: false,
status, status,
sender: std::sync::mpsc::channel().0, sender: std::sync::mpsc::channel().0,
queue_position: None, queue_position: None,
+1
View File
@@ -56,6 +56,7 @@ impl Window {
let tui = MainTui::new( let tui = MainTui::new(
client, client,
downloads.display().to_string(), downloads.display().to_string(),
false,
SEARCH_WINDOW, SEARCH_WINDOW,
Some(StateStore::new(state.to_path_buf())), Some(StateStore::new(state.to_path_buf())),
None, None,