summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/duplicate-login-names_test.bats15
-rw-r--r--test/fixtures/passwd_with_duplicate_login_names3
2 files changed, 18 insertions, 0 deletions
diff --git a/test/duplicate-login-names_test.bats b/test/duplicate-login-names_test.bats
new file mode 100644
index 0000000..f91d0a2
--- /dev/null
+++ b/test/duplicate-login-names_test.bats
@@ -0,0 +1,15 @@
+#!/usr/bin/env bats
+
+load test_helper
+
+@test "it finds users with duplicate login names" {
+ run ./bin/duplicate-login-names test/fixtures/passwd_with_duplicate_login_names
+
+ assert_failure $'root'
+}
+
+@test "it does not find any duplicate login names" {
+ run ./bin/duplicate-login-names test/fixtures/passwd
+
+ assert_success
+}
diff --git a/test/fixtures/passwd_with_duplicate_login_names b/test/fixtures/passwd_with_duplicate_login_names
new file mode 100644
index 0000000..e943ab4
--- /dev/null
+++ b/test/fixtures/passwd_with_duplicate_login_names
@@ -0,0 +1,3 @@
+root:x:0:0:root:/root:/bin/bash
+bin:x:1:1:bin:/bin:/sbin/nologin
+root:x:2:2:daemon:/sbin:/sbin/nologin