# Test that `cue login` fails gracefully when the registry
# does not support the OAuth2 device flow at all,
# such as when /login/device/code returns HTTP 404 or 405.

env CUE_CONFIG_DIR=$WORK/cueconfig

# A registry returning 404 for the device code endpoint.
oauthregistry device-code-not-found

! exec cue login
cmp stderr stderr-not-found
! exists cueconfig/logins.json

# A registry returning 405 for the device code endpoint.
oauthregistry device-code-method-not-allowed

! exec cue login
cmp stderr stderr-method-not-allowed
! exists cueconfig/logins.json

-- stderr-not-found --
cannot start the OAuth2 device flow: 404 Not Found

To log into a standard OCI registry, use 'docker login' or 'podman login' instead:

	https://cuelang.org/docs/reference/modules/#authorization

-- stderr-method-not-allowed --
cannot start the OAuth2 device flow: 405 Method Not Allowed

To log into a standard OCI registry, use 'docker login' or 'podman login' instead:

	https://cuelang.org/docs/reference/modules/#authorization

