(ctx context.Context)
| 404 | } |
| 405 | |
| 406 | func (ctl *controller) signupAndLogin(ctx context.Context) (string, error) { |
| 407 | // Use Signup API (creates principal + workspace) then Login to get a token. |
| 408 | if _, err := ctl.authServiceClient.Signup(ctx, connect.NewRequest(&v1pb.SignupRequest{ |
| 409 | Email: "demo@example.com", |
| 410 | Password: "1024bytebase", |
| 411 | Title: "demo", |
| 412 | })); err != nil && !strings.Contains(err.Error(), "already registered") { |
| 413 | return "", err |
| 414 | } |
| 415 | loginResp, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{ |
| 416 | Email: "demo@example.com", |
| 417 | Password: "1024bytebase", |
| 418 | })) |
| 419 | if err != nil { |
| 420 | return "", err |
| 421 | } |
| 422 | ctl.principalName = common.FormatUserEmail("demo@example.com") |
| 423 | return loginResp.Msg.Token, nil |
| 424 | } |
no test coverage detected