global is being global and i can select it and so on

This commit is contained in:
Priec
2026-08-13 22:51:57 +02:00
parent df145c14f7
commit 05f29b82f6
7 changed files with 368 additions and 130 deletions

View File

@@ -289,6 +289,50 @@ mod tests {
assert!(!html.contains("/admin/profiles/copy?profile=billing\" method"));
}
/// The other half of `a_global_table_is_offered_the_same_actions`: what the
/// admin panel links to for a global table is a page that deletes it,
/// rather than one that says no table was chosen.
#[test]
fn the_delete_page_accepts_a_global_table() {
let mut state = page();
state.selection = Selection {
profile: crate::pages::GLOBAL_SCOPE.to_string(),
table: "currencies".to_string(),
};
state.tables = vec![TableSummary {
name: "currencies".to_string(),
table_kind: "dynamic".to_string(),
global: true,
depends_on: Vec::new(),
}];
state.active = "delete";
let html = render_delete_page(&state);
assert!(!html.contains("Template error"), "{html}");
assert!(html.contains("Type <code>currencies</code> to confirm"), "{html}");
assert!(!html.contains("No table chosen"));
// The sentinel is never shown as if it were a profile's name.
assert!(html.contains("Global — all profiles"));
}
/// And when the table really is gone, the page says which one rather than
/// telling someone who just picked one to go and pick one. The loader is
/// what clears the selection and sets the reason.
#[test]
fn a_dropped_selection_is_explained() {
let mut state = page();
state.selection.table = String::new();
state.detail = None;
state.error = Some("`invoice` is not a table of billing.".to_string());
state.active = "delete";
let html = render_delete_page(&state);
assert!(html.contains("`invoice` is not a table of billing."), "{html}");
assert!(html.contains("No table chosen"));
}
/// A system table is the backend's own; every write is refused for it, so
/// none of the write pages offer their form.
#[test]