diff options
| author | David Bremner <david@tethera.net> | 2021-02-14 09:23:44 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-03-27 09:26:14 -0300 |
| commit | e81dc2072f22996a07e82b9b9b2eac826410e5a7 (patch) | |
| tree | 1900a4bf8abba9de2d060a974dbb8f2fdd4aae39 /test | |
| parent | 863b2431853385441f9fcbc22b9ff4e963091440 (diff) | |
lib/config: set defaults for user full name
This just copies code from from the CLI into the library. New test
infrastructure is needed because apparently we have never tested this
code path.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T590-libconfig.sh | 13 | ||||
| -rw-r--r-- | test/test-lib.sh | 7 |
2 files changed, 16 insertions, 4 deletions
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 49cc382a..2c6e726c 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -384,6 +384,9 @@ cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} '' %NULL% } } EOF + +notmuch_passwd_sanitize < OUTPUT > OUTPUT.clean + cat <<'EOF' >EXPECTED == stdout == MAIL_DIR @@ -396,11 +399,11 @@ NULL true NULL NULL -NULL +USER_FULL_NAME == stderr == EOF unset MAILDIR -test_expect_equal_file EXPECTED OUTPUT +test_expect_equal_file EXPECTED OUTPUT.clean backup_database test_begin_subtest "override config from \${NOTMUCH_CONFIG}" @@ -727,6 +730,8 @@ cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} /nonexistent %NULL% } } EOF + +notmuch_passwd_sanitize < OUTPUT > OUTPUT.clean cat <<'EOF' >EXPECTED == stdout == MAIL_DIR @@ -739,10 +744,10 @@ NULL true NULL NULL -NULL +USER_FULL_NAME == stderr == EOF -test_expect_equal_file EXPECTED OUTPUT +test_expect_equal_file EXPECTED OUTPUT.clean backup_database test_begin_subtest "override config from \${HOME}/.notmuch-config (ndlc)" diff --git a/test/test-lib.sh b/test/test-lib.sh index fc176af8..fa2e401e 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -694,6 +694,13 @@ notmuch_built_with_sanitize () sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/' } +notmuch_passwd_sanitize () +{ + local user=$(id -un) + local full_name=$(getent passwd $user | cut -d: -f 5 | cut -d, -f1) + sed "s/$full_name/USER_FULL_NAME/" +} + notmuch_config_sanitize () { notmuch_dir_sanitize | notmuch_built_with_sanitize |
