test(passkeys): end the options before a passkey id that may start with a dash
The id is random base64url, so one in 64 starts with "-" and cobra took it for a flag: TestPasskeyEndToEnd failed on CI at random.
- commit
- 1dfc7dce8e71006d413caa473e7d2b90dcfe0bed
- author
- brice · · 2026-10-13 11:41 UTC
- parent
- 71757c4
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +2 -2
M internal/app/web_passkey_test.go +2 -2
| @@ -188,7 +188,7 @@ func TestPasskeyEndToEnd(t *testing.T) { | |||
| 188 | 188 | assert.Equal(t, base64.RawURLEncoding.EncodeToString(p.cred.ID), listed[0].ID) | |
| 189 | 189 | assert.NotNil(t, listed[0].LastUsedAt, "the sign-in was recorded") | |
| 190 | 190 | ||
| 191 | - | rm := p.cli(t, adminToken, "web", "passkey", "remove", listed[0].ID).ok(t) | |
| 191 | + | rm := p.cli(t, adminToken, "web", "passkey", "remove", "--", listed[0].ID).ok(t) | |
| 192 | 192 | assert.Contains(t, rm.stderr, "every browser is signed out") | |
| 193 | 193 | for _, tok := range []string{token, ck.Value} { | |
| 194 | 194 | assert.Equal(t, http.StatusNotFound, p.b.get("/-/passkeys", as(tok)).status, "the epoch moved: both sessions are gone") | |
| @@ -197,7 +197,7 @@ func TestPasskeyEndToEnd(t *testing.T) { | |||
| 197 | 197 | res = p.login() | |
| 198 | 198 | assert.Equal(t, http.StatusUnauthorized, res.status, res.body) | |
| 199 | 199 | assert.Empty(t, res.hdr.Values("Set-Cookie")) | |
| 200 | - | again := p.cli(t, adminToken, "web", "passkey", "remove", listed[0].ID) | |
| 200 | + | again := p.cli(t, adminToken, "web", "passkey", "remove", "--", listed[0].ID) | |
| 201 | 201 | require.Error(t, again.err) | |
| 202 | 202 | assert.Contains(t, again.err.Error(), "not found") | |
| 203 | 203 | } | |
| @@ -188,7 +188,7 @@ func TestPasskeyEndToEnd(t *testing.T) { | |||||
| 188 | assert.Equal(t, base64.RawURLEncoding.EncodeToString(p.cred.ID), listed[0].ID) | 188 | assert.Equal(t, base64.RawURLEncoding.EncodeToString(p.cred.ID), listed[0].ID) | ||
| 189 | assert.NotNil(t, listed[0].LastUsedAt, "the sign-in was recorded") | 189 | assert.NotNil(t, listed[0].LastUsedAt, "the sign-in was recorded") | ||
| 190 | 190 | ||||
| 191 | - | rm := p.cli(t, adminToken, "web", "passkey", "remove", listed[0].ID).ok(t) | 191 | + | rm := p.cli(t, adminToken, "web", "passkey", "remove", "--", listed[0].ID).ok(t) |
| 192 | assert.Contains(t, rm.stderr, "every browser is signed out") | 192 | assert.Contains(t, rm.stderr, "every browser is signed out") | ||
| 193 | for _, tok := range []string{token, ck.Value} { | 193 | for _, tok := range []string{token, ck.Value} { | ||
| 194 | assert.Equal(t, http.StatusNotFound, p.b.get("/-/passkeys", as(tok)).status, "the epoch moved: both sessions are gone") | 194 | assert.Equal(t, http.StatusNotFound, p.b.get("/-/passkeys", as(tok)).status, "the epoch moved: both sessions are gone") | ||
| @@ -197,7 +197,7 @@ func TestPasskeyEndToEnd(t *testing.T) { | |||||
| 197 | res = p.login() | 197 | res = p.login() | ||
| 198 | assert.Equal(t, http.StatusUnauthorized, res.status, res.body) | 198 | assert.Equal(t, http.StatusUnauthorized, res.status, res.body) | ||
| 199 | assert.Empty(t, res.hdr.Values("Set-Cookie")) | 199 | assert.Empty(t, res.hdr.Values("Set-Cookie")) | ||
| 200 | - | again := p.cli(t, adminToken, "web", "passkey", "remove", listed[0].ID) | 200 | + | again := p.cli(t, adminToken, "web", "passkey", "remove", "--", listed[0].ID) |
| 201 | require.Error(t, again.err) | 201 | require.Error(t, again.err) | ||
| 202 | assert.Contains(t, again.err.Error(), "not found") | 202 | assert.Contains(t, again.err.Error(), "not found") | ||
| 203 | } | 203 | } | ||