diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/passwd_with_missing_password | 3 | ||||
| -rw-r--r-- | test/no-password_test.bats | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/fixtures/passwd_with_missing_password b/test/fixtures/passwd_with_missing_password new file mode 100644 index 0000000..37f51ad --- /dev/null +++ b/test/fixtures/passwd_with_missing_password @@ -0,0 +1,3 @@ +nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false +root:*:0:0:System Administrator:/var/root:/bin/sh +daemon::1:1:daemon:/tmp:/usr/bin/false diff --git a/test/no-password_test.bats b/test/no-password_test.bats new file mode 100644 index 0000000..815b25e --- /dev/null +++ b/test/no-password_test.bats @@ -0,0 +1,15 @@ +#!/usr/bin/env bats + +load test_helper + +@test "it finds a user without a password" { + run ./bin/no-password test/fixtures/passwd_with_missing_password + + assert_success $'daemon::1:1:daemon:/tmp:/usr/bin/false' +} + +@test "it does not find any users that are missing a password" { + run ./bin/no-password test/fixtures/passwd_with_uid_zero + + assert_failure $'' +} |
