feat: own shared user API tokens
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user