CreateFirstUser creates a user with preset credentials and authenticates with the passed in codersdk client.
(t testing.TB, client *codersdk.Client)
| 827 | // CreateFirstUser creates a user with preset credentials and authenticates |
| 828 | // with the passed in codersdk client. |
| 829 | func CreateFirstUser(t testing.TB, client *codersdk.Client) codersdk.CreateFirstUserResponse { |
| 830 | resp, err := client.CreateFirstUser(context.Background(), FirstUserParams) |
| 831 | require.NoError(t, err) |
| 832 | |
| 833 | login, err := client.LoginWithPassword(context.Background(), codersdk.LoginWithPasswordRequest{ |
| 834 | Email: FirstUserParams.Email, |
| 835 | Password: FirstUserParams.Password, |
| 836 | }) |
| 837 | require.NoError(t, err) |
| 838 | client.SetSessionToken(login.SessionToken) |
| 839 | return resp |
| 840 | } |
| 841 | |
| 842 | // CreateAnotherUser creates and authenticates a new user. |
| 843 | // Roles can include org scoped roles with 'roleName:<organization_id>' |