Merge branch 'jc/advice-doc'
[git] / t / t0303-credential-external.sh
1 #!/bin/sh
2
3 test_description='external credential helper tests'
4 . ./test-lib.sh
5 . "$TEST_DIRECTORY"/lib-credential.sh
6
7 pre_test() {
8         test -z "$GIT_TEST_CREDENTIAL_HELPER_SETUP" ||
9         eval "$GIT_TEST_CREDENTIAL_HELPER_SETUP"
10
11         # clean before the test in case there is cruft left
12         # over from a previous run that would impact results
13         helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
14 }
15
16 post_test() {
17         # clean afterwards so that we are good citizens
18         # and don't leave cruft in the helper's storage, which
19         # might be long-term system storage
20         helper_test_clean "$GIT_TEST_CREDENTIAL_HELPER"
21 }
22
23 if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
24         say "# skipping external helper tests (set GIT_TEST_CREDENTIAL_HELPER)"
25 else
26         pre_test
27         helper_test "$GIT_TEST_CREDENTIAL_HELPER"
28         post_test
29 fi
30
31 if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
32         say "# skipping external helper timeout tests"
33 else
34         pre_test
35         helper_test_timeout "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"
36         post_test
37 fi
38
39 test_done