Skip to content

Commit

Permalink
Add e2e for password-file
Browse files Browse the repository at this point in the history
  • Loading branch information
thockin committed Sep 20, 2023
1 parent d4244a3 commit f585d09
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ function e2e::sync_depth_change_on_restart() {
}

##############################################
# Test HTTP with password
# Test HTTP basicauth with a password
##############################################
function e2e::auth_http_password() {
# Run a git-over-HTTP server.
Expand Down Expand Up @@ -1691,6 +1691,45 @@ function e2e::auth_http_password() {
assert_file_eq "$ROOT/link/file" "$FUNCNAME"
}

##############################################
# Test HTTP basicauth with a password-file
##############################################
function e2e::auth_http_password_file_incorrect() {
# Run a git-over-HTTP server.
CTR=$(docker_run \
-v "$REPO":/git/repo:ro \
e2e/test/httpd)
IP=$(docker_ip "$CTR")

# Make a password file with a bad password.
echo -n "wrong" > "$WORK/password-file"

GIT_SYNC \
--one-time \
--repo="http://$IP/repo" \
--root="$ROOT" \
--link="link" \
--username="testuser" \
--password-file="$WORK/password-file" \
|| true
assert_file_absent "$ROOT/link/file"

# Make a password file the ritgh password.
echo -n "testpass" > "$WORK/password-file"

GIT_SYNC \
--one-time \
--repo="http://$IP/repo" \
--root="$ROOT" \
--link="link" \
--username="test" \
--password-file="$WORK/password-file"

assert_link_exists "$ROOT/link"
assert_file_exists "$ROOT/link/file"
assert_file_eq "$ROOT/link/file" "$FUNCNAME"
}

##############################################
# Test SSH with bad key
##############################################
Expand Down

0 comments on commit f585d09

Please sign in to comment.