summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-06-07 13:06:53 +0200
committerPatrick Steinhardt <ps@pks.im>2018-01-03 11:50:39 +0000
commit54a1bf057a1123cf55ac3447c79761c817382f47 (patch)
tree1280fd80ea7c1752cf15898b131c9f213ad60b2b /tests
parentfea6092079d5c09b499e472efead2f7aa81ce8a1 (diff)
downloadlibgit2-54a1bf057a1123cf55ac3447c79761c817382f47.tar.gz
tests: online::clone: inline creds-test with nonexistent URL
Right now, we test our credential callback code twice, once via SSH on localhost and once via a non-existent GitHub repository. While the first URL makes sense to be configurable, it does not make sense to hard-code the non-existing repository, which requires us to call tests multiple times. Instead, we can just inline the URL into another set of tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/online/clone.c8
2 files changed, 4 insertions, 5 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2d18391bd..fbc3d41e5 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -60,5 +60,4 @@ ENDIF ()
# Add a test target which runs the cred callback tests, to be
# called after setting the url and user
-ADD_TEST(libgit2_clar-cred_callback "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::cred_callback)
ADD_TEST(libgit2_clar-proxy_credentials "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)
diff --git a/tests/online/clone.c b/tests/online/clone.c
index b6709869e..b9230eca6 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -263,8 +263,8 @@ static int cred_failure_cb(
void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
{
- if (!_remote_url || !_remote_user)
- clar__skip();
+ _remote_url = git__strdup("https://github.com/libgit2/non-existent");
+ _remote_user = git__strdup("libgit2test");
g_options.fetch_opts.callbacks.credentials = cred_failure_cb;
@@ -293,8 +293,8 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void)
{
size_t counter = 0;
- if (!_remote_url || !_remote_user)
- clar__skip();
+ _remote_url = git__strdup("https://github.com/libgit2/non-existent");
+ _remote_user = git__strdup("libgit2test");
g_options.fetch_opts.callbacks.credentials = cred_count_calls_cb;
g_options.fetch_opts.callbacks.payload = &counter;