t: test basic smart-http authentication

We do not currently test authentication over smart-http at all. In theory, it should work exactly as it does for dumb http (which we do test). It does indeed work for these simple tests, but this patch lays the groundwork for more complex tests in future patches. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 27, 2012 at 09:25 UTC 6ac2b3aeb9900a8fb0cd3fd9be0bff00eb3a4b5b
2 files changed +25
t/t5541-http-push.sh
+14
@@ -36,6 +36,8 @@ test_expect_success 'setup remote repository' '
36 mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
37 '
38
39 +setup_askpass_helper
40 +
41 cat >exp <<EOF
42 GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
43 POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
@@ -266,5 +268,17 @@ test_expect_success 'http push respects GIT_COMMITTER_* in reflog' '
268 test_cmp expect actual
269 '
270
271 +test_expect_success 'push over smart http with auth' '
272 + cd "$ROOT_PATH/test_repo_clone" &&
273 + echo push-auth-test >expect &&
274 + test_commit push-auth-test &&
275 + set_askpass user@host &&
276 + git push "$HTTPD_URL"/auth/smart/test_repo.git &&
277 + git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git" \
278 + log -1 --format=%s >actual &&
279 + expect_askpass both user@host &&
280 + test_cmp expect actual
281 +'
282 +
283 stop_httpd
284 test_done
t/t5551-http-fetch.sh
+11
@@ -27,6 +27,8 @@ test_expect_success 'create http-accessible bare repository' '
27 git push public master:master
28 '
29
30 +setup_askpass_helper
31 +
32 cat >exp <<EOF
33 > GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
34 > Accept: */*
@@ -109,6 +111,15 @@ test_expect_success 'follow redirects (302)' '
111 git clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t
112 '
113
114 +test_expect_success 'clone from password-protected repository' '
115 + echo two >expect &&
116 + set_askpass user@host &&
117 + git clone --bare "$HTTPD_URL/auth/smart/repo.git" smart-auth &&
118 + expect_askpass both user@host &&
119 + git --git-dir=smart-auth log -1 --format=%s >actual &&
120 + test_cmp expect actual
121 +'
122 +
123 test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
124
125 test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '