Add bats tests for 8 remaining modules: demo, harden, ma_detect, monitor, report, selfupdate, status, vpn
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/demo.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "run_demo exits cleanly" {
|
||||||
|
run run_demo 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "run_demo contains demo steps" {
|
||||||
|
run run_demo 2>/dev/null || true
|
||||||
|
echo "$output" | grep -qi "demo"
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/harden.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "do_harden requires root" {
|
||||||
|
EUID=501
|
||||||
|
run do_harden 2>/dev/null || true
|
||||||
|
[ "$status" -ne 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "install_harden_launchdaemon creates plist" {
|
||||||
|
run install_harden_launchdaemon 2>/dev/null || true
|
||||||
|
[ -f /Library/LaunchDaemons/com.unleash.harden.plist ] || [ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/ma_detect.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "detect_migration_assistant exits cleanly" {
|
||||||
|
run detect_migration_assistant 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "clean_ma_artifacts does not error without users" {
|
||||||
|
run clean_ma_artifacts 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/monitor.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "monitor_status exits cleanly when not running" {
|
||||||
|
run monitor_status 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "stop_monitor exits cleanly when not running" {
|
||||||
|
run stop_monitor 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/report.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "generate_report exits cleanly" {
|
||||||
|
run generate_report 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "generate_report_json has json structure" {
|
||||||
|
run generate_report_json 2>/dev/null || true
|
||||||
|
echo "$output" | grep -q "}"
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/selfupdate.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "check_for_updates handles no network" {
|
||||||
|
run check_for_updates 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "get_latest_version fails gracefully offline" {
|
||||||
|
run get_latest_version 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/status.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "show_status exits cleanly" {
|
||||||
|
run show_status 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "show_status_detailed exits cleanly" {
|
||||||
|
run show_status_detailed 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
load '../lib/colors.sh'
|
||||||
|
load '../lib/vpn.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "install_vpn_killswitch exits cleanly" {
|
||||||
|
run install_vpn_killswitch 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "remove_vpn_killswitch exits cleanly" {
|
||||||
|
run remove_vpn_killswitch 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "vpn_killswitch_status exits cleanly" {
|
||||||
|
run vpn_killswitch_status 2>/dev/null || true
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user