MCPcopy Index your code
hub / github.com/coder/coder / CreateFirstUser

Function CreateFirstUser

coderd/coderdtest/coderdtest.go:829–840  ·  view source on GitHub ↗

CreateFirstUser creates a user with preset credentials and authenticates with the passed in codersdk client.

(t testing.TB, client *codersdk.Client)

Source from the content-addressed store, hash-verified

827// CreateFirstUser creates a user with preset credentials and authenticates
828// with the passed in codersdk client.
829func 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>'

Calls 3

CreateFirstUserMethod · 0.80
LoginWithPasswordMethod · 0.80
SetSessionTokenMethod · 0.80