diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-11-13 16:46:45 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2013-11-18 12:56:34 -0500 |
| commit | 80fc7d6bf08834acc5696c8f0c73680236f84375 (patch) | |
| tree | f8854b3748639d91bdaea108ba8e81dbff30880c /tests | |
| parent | 872094441c165446a7bb989c0f215e1a4018218e (diff) | |
| download | libgit2-80fc7d6bf08834acc5696c8f0c73680236f84375.tar.gz | |
Propagate auth error codes as GIT_EUSER in winhttp
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/online/clone.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c index aa3d6b26a..d036a5a47 100644 --- a/tests/online/clone.c +++ b/tests/online/clone.c @@ -183,6 +183,39 @@ void test_online_clone__custom_remote_callbacks(void) cl_assert(callcount > 0); } +static int cred_failure_cb( + git_cred **cred, + const char *url, + const char *username_from_url, + unsigned int allowed_types, + void *data) +{ + return -1; +} + +void test_online_clone__cred_callback_failure_is_euser(void) +{ + const char *remote_url = cl_getenv("GITTEST_REMOTE_URL"); + const char *remote_user = cl_getenv("GITTEST_REMOTE_USER"); + const char *remote_default = cl_getenv("GITTEST_REMOTE_DEFAULT"); + int error; + + if (!remote_url) { + printf("GITTEST_REMOTE_URL unset; skipping clone test\n"); + return; + } + + if (!remote_user && !remote_default) { + printf("GITTEST_REMOTE_USER and GITTEST_REMOTE_DEFAULT unset; skipping clone test\n"); + return; + } + + g_options.remote_callbacks.credentials = cred_failure_cb; + + cl_git_fail(error = git_clone(&g_repo, remote_url, "./foo", &g_options)); + cl_assert_equal_i(error, GIT_EUSER); +} + void test_online_clone__credentials(void) { /* Remote URL environment variable must be set. User and password are optional. */ |
