Files
podman/test/apiv2/60-auth.at
Valentin Rothberg 60e58f0594 test/apiv2/60-auth.at: use doesnotexists.podman.io
`exist.io` actually does exist and is not under our control.  To prevent
flakes, change it to something on `podman.io`.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-24 16:22:02 +02:00

42 lines
1.3 KiB
Bash

# -*- sh -*-
#
# registry-related tests
#
start_registry htpasswd
# Test unreachable
t POST /v1.40/auth username=$REGISTRY_USERNAME password=WrOnGPassWord serveraddress=doesnotexists.podman.io:1234/ \
500 \
.message~'.*no such host.*'
# Test with wrong password. Confirm bad status and appropriate error message
t POST /v1.40/auth username=$REGISTRY_USERNAME password=WrOnGPassWord serveraddress=localhost:$REGISTRY_PORT/ \
500 \
.message~'.* 401 Unauthorized'
# Test with the right password. Confirm status message
t POST /v1.40/auth username=$REGISTRY_USERNAME password=$REGISTRY_PASSWORD serveraddress=localhost:$REGISTRY_PORT/ \
200 \
.Status="Login Succeeded" \
.IdentityToken=""
# Same test with url scheme provided
t POST /v1.40/auth username=$REGISTRY_USERNAME password=$REGISTRY_PASSWORD serveraddress=https://localhost:$REGISTRY_PORT/ \
200 \
.Status="Login Succeeded" \
.IdentityToken=""
# No username -> error
t POST /v1.40/auth password=$REGISTRY_PASSWORD serveraddress=localhost:$REGISTRY_PORT/ \
500 \
.message~'.* cannot prompt for username without stdin'
# No password -> error
t POST /v1.40/auth username=$REGISTRY_USERNAME serveraddress=https://localhost:$REGISTRY_PORT/ \
500 \
.message~'.* reading password: inappropriate ioctl for device'
stop_registry