42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
|
|
|
run_node_test <<'JS'
|
|
const polkit = requireFromRoot('shell/plugins/polkit/PolkitModel.js')
|
|
|
|
assert(polkit.promptLooksFingerprint('Swipe your finger'), 'polkit detects fingerprint prompts')
|
|
assert(polkit.promptLooksFingerprint('fprintd verification'), 'polkit detects fprint prompts')
|
|
assert(!polkit.promptLooksFingerprint('Password:'), 'polkit ignores password prompts')
|
|
|
|
assertEqual(
|
|
polkit.authorizationLabel("Authentication is needed to run `/usr/bin/true' as the super user"),
|
|
"Authorize running '/usr/bin/true'",
|
|
'polkit shortens the standard pkexec message'
|
|
)
|
|
assertEqual(
|
|
polkit.authorizationLabel('Authentication is required to change system settings'),
|
|
'Authentication is required to change system settings',
|
|
'polkit preserves custom authorization messages'
|
|
)
|
|
|
|
assert(
|
|
polkit.fingerprintFirstFromPamConfig(`
|
|
# comment
|
|
auth sufficient pam_fprintd.so
|
|
auth include system-auth
|
|
`),
|
|
'polkit detects fingerprint-first PAM config'
|
|
)
|
|
assert(
|
|
!polkit.fingerprintFirstFromPamConfig(`
|
|
account include system-auth
|
|
auth include system-auth
|
|
auth sufficient pam_fprintd.so
|
|
`),
|
|
'polkit detects password-first PAM config'
|
|
)
|
|
JS
|