t / t0303-credential-external.shon commit Merge branch 'jk/prompt-fallback-to-tty' into maint (f3f3c4d)
   1#!/bin/sh
   2
   3test_description='external credential helper tests'
   4. ./test-lib.sh
   5. "$TEST_DIRECTORY"/lib-credential.sh
   6
   7pre_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
  16post_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
  23if test -z "$GIT_TEST_CREDENTIAL_HELPER"; then
  24        say "# skipping external helper tests (set GIT_TEST_CREDENTIAL_HELPER)"
  25else
  26        pre_test
  27        helper_test "$GIT_TEST_CREDENTIAL_HELPER"
  28        post_test
  29fi
  30
  31if test -z "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"; then
  32        say "# skipping external helper timeout tests"
  33else
  34        pre_test
  35        helper_test_timeout "$GIT_TEST_CREDENTIAL_HELPER_TIMEOUT"
  36        post_test
  37fi
  38
  39test_done