Repair Tailscale authorization flow
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||
|
||||
test_tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$test_tmp"' EXIT
|
||||
|
||||
mock_bin="$test_tmp/bin"
|
||||
test_home="$test_tmp/home"
|
||||
mkdir -p "$mock_bin" "$test_home/.local/share/applications"
|
||||
|
||||
cat >"$test_home/.local/share/applications/chromium.desktop" <<'EOF'
|
||||
[Desktop Entry]
|
||||
Exec=chromium %U
|
||||
EOF
|
||||
|
||||
cat >"$mock_bin/xdg-settings" <<'SH'
|
||||
#!/bin/bash
|
||||
echo chromium.desktop
|
||||
SH
|
||||
cat >"$mock_bin/chromium" <<'SH'
|
||||
#!/bin/bash
|
||||
exit 0
|
||||
SH
|
||||
cat >"$mock_bin/systemd-run" <<'SH'
|
||||
#!/bin/bash
|
||||
printf '%s\n' "$*" >"$OMARCHY_TEST_BROWSER_LAUNCH"
|
||||
SH
|
||||
cat >"$mock_bin/omarchy-hyprland-focus-app" <<'SH'
|
||||
#!/bin/bash
|
||||
printf '%s\n' "$1" >"$OMARCHY_TEST_BROWSER_FOCUS"
|
||||
SH
|
||||
chmod +x "$mock_bin"/*
|
||||
|
||||
launch_log="$test_tmp/launch"
|
||||
focus_log="$test_tmp/focus"
|
||||
HOME="$test_home" PATH="$mock_bin:$PATH" HYPRLAND_INSTANCE_SIGNATURE=test \
|
||||
OMARCHY_TEST_BROWSER_LAUNCH="$launch_log" OMARCHY_TEST_BROWSER_FOCUS="$focus_log" \
|
||||
bash "$ROOT/bin/omarchy-launch-browser" "https://example.test/authorize"
|
||||
|
||||
grep -F 'https://example.test/authorize' "$launch_log" >/dev/null || fail "browser launcher passes through the URL"
|
||||
grep -Fx '^chromium.*$' "$focus_log" >/dev/null || fail "browser launcher focuses the default browser window"
|
||||
|
||||
pass "browser launcher follows opened links to the browser workspace"
|
||||
Reference in New Issue
Block a user