Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
572 B
Go
25 lines
572 B
Go
package backup
|
|
|
|
import "testing"
|
|
|
|
func TestValidBackupFileName(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
ok bool
|
|
}{
|
|
{"backup_2026_05_22_01.sql", true},
|
|
{"backup_2026_08_29_12.sql", true},
|
|
{"", false},
|
|
{"../etc/passwd", false},
|
|
{"backup_2026_05_22_01.sql/../../x", false},
|
|
{"foo.sql", false},
|
|
{"backup_2026_05_22_01.sql.exe", false},
|
|
{"backup_2026_05_22_01.sql ", false},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := validBackupFileName(tt.name); got != tt.ok {
|
|
t.Errorf("validBackupFileName(%q) = %v, want %v", tt.name, got, tt.ok)
|
|
}
|
|
}
|
|
}
|