diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-03-19 09:20:35 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2018-03-19 15:45:20 -0700 |
commit | 03c5877810460551e30d8dadf8aad9131b79bc71 (patch) | |
tree | b4948400755bff05ac4587fdac7e652b6f681db9 | |
parent | 937e7e26407b920dde069a3398e33ccfaab61890 (diff) | |
download | libgit2-03c5877810460551e30d8dadf8aad9131b79bc71.tar.gz |
online::clone: skip creds fallback test
At present, we have three online tests against bitbucket: one which
specifies the credentials in the payload, one which specifies the
correct credentials in the URL and a final one that specifies the
incorrect credentials in the URL. Bitbucket has begun responding to the
latter test with a 403, which causes us to fail.
Break these three tests into separate tests so that we can skip the
latter until this is resolved on Bitbucket's end or until we can change
the test to a different provider.
-rw-r--r-- | tests/online/clone.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/tests/online/clone.c b/tests/online/clone.c index af6b30580..4b73e0a5f 100644 --- a/tests/online/clone.c +++ b/tests/online/clone.c @@ -357,15 +357,45 @@ void test_online_clone__bitbucket_style(void) cl_git_pass(git_clone(&g_repo, BB_REPO_URL, "./foo", &g_options)); git_repository_free(g_repo); g_repo = NULL; cl_fixture_cleanup("./foo"); +} + +void test_online_clone__bitbucket_uses_creds_in_url(void) +{ + git_cred_userpass_payload user_pass = { + "libgit2", "wrong" + }; + + g_options.fetch_opts.callbacks.credentials = git_cred_userpass; + g_options.fetch_opts.callbacks.payload = &user_pass; - /* User and pass from URL */ - user_pass.password = "wrong"; + /* + * Correct user and pass are in the URL; the (incorrect) creds in + * the `git_cred_userpass_payload` should be ignored. + */ cl_git_pass(git_clone(&g_repo, BB_REPO_URL_WITH_PASS, "./foo", &g_options)); git_repository_free(g_repo); g_repo = NULL; cl_fixture_cleanup("./foo"); +} + +void test_online_clone__bitbucket_falls_back_to_specified_creds(void) +{ + git_cred_userpass_payload user_pass = { + "libgit2", "libgit2" + }; + + g_options.fetch_opts.callbacks.credentials = git_cred_userpass; + g_options.fetch_opts.callbacks.payload = &user_pass; + + /* + * TODO: as of March 2018, bitbucket sporadically fails with + * 403s instead of replying with a 401 - but only sometimes. + */ + cl_skip(); - /* Wrong password in URL, fall back to user_pass */ - user_pass.password = "libgit2"; + /* + * Incorrect user and pass are in the URL; the (correct) creds in + * the `git_cred_userpass_payload` should be used as a fallback. + */ cl_git_pass(git_clone(&g_repo, BB_REPO_URL_WITH_WRONG_PASS, "./foo", &g_options)); git_repository_free(g_repo); g_repo = NULL; cl_fixture_cleanup("./foo"); |