feat: own shared user API tokens

This commit is contained in:
Jakub Zych
2026-10-04 22:15:57 +02:00
parent 8a658903ed
commit 0fe5b91b63
17 changed files with 926 additions and 35 deletions

View File

@@ -17,12 +17,19 @@ func TestRequirePasswordChange(t *testing.T) {
p := &Plugin{app: app}
var _ pact.HasCommands = p
cmds := p.Commands()
if len(cmds) != 1 || cmds[0].Name != "user:require-password-change" {
var cmd bonfire.Command
for _, candidate := range cmds {
if candidate.Name == "user:require-password-change" {
cmd = candidate
break
}
}
if cmd.Name == "" {
t.Fatalf("commands = %#v", cmds)
}
var buf bytes.Buffer
out := bonfire.NewOutput(nil, &buf, &buf)
if err := cmds[0].Run(context.Background(), emailArg{email: "alice@example.com"}, out); err != nil {
if err := cmd.Run(context.Background(), emailArg{email: "alice@example.com"}, out); err != nil {
t.Fatal(err)
}
if !strings.Contains(buf.String(), "alice@example.com") {
@@ -35,7 +42,7 @@ func TestRequirePasswordChange(t *testing.T) {
if !fresh.MustChangePassword {
t.Fatal("must_change_password stayed false")
}
if err := cmds[0].Run(context.Background(), emailArg{email: "missing@example.com"}, out); err == nil {
if err := cmd.Run(context.Background(), emailArg{email: "missing@example.com"}, out); err == nil {
t.Fatal("unknown email returned nil error")
}
}