diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-01 13:37:03 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-07-01 13:44:34 +0200 |
commit | ac908aa749f9854a257f6d4957e1342a4db0e1f9 (patch) | |
tree | 50df9d279d9cfceca82d91f7a327056f2710729a /tests/fake_adduser_test | |
parent | 207733ab8d3863b469c0c173714953eedda60bb8 (diff) | |
download | alpine-conf-ac908aa749f9854a257f6d4957e1342a4db0e1f9.zip |
tests: add fake adduser
So we can simulate what happens when adduser fails
ref https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10519
Diffstat (limited to 'tests/fake_adduser_test')
-rwxr-xr-x | tests/fake_adduser_test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/fake_adduser_test b/tests/fake_adduser_test new file mode 100755 index 0000000..fe13690 --- /dev/null +++ b/tests/fake_adduser_test @@ -0,0 +1,21 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/test_env.sh +init_tests \ + fake_adduser_usage \ + fake_adduser_failure + +fake_adduser_usage_body() { + init_env + atf_check -s exit:0 \ + -e match:"Usage: adduser" \ + adduser --help +} + +fake_adduser_failure_body() { + init_env + ADDUSER_EXIST=juser atf_check -s exit:1 \ + -e match:"adduser: user 'juser' in use" \ + adduser juser +} + |