Add shell plugin model tests
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/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')
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user