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

Function Test_UserConfig

scaletest/createworkspaces/config_test.go:18–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func Test_UserConfig(t *testing.T) {
19 t.Parallel()
20
21 id := uuid.New()
22
23 cases := []struct {
24 name string
25 config createworkspaces.UserConfig
26 errContains string
27 }{
28 {
29 name: "OK",
30 config: createworkspaces.UserConfig{
31 OrganizationID: id,
32 Username: "test",
33 Email: "test@test.coder.com",
34 },
35 },
36 {
37 name: "NoOrganizationID",
38 config: createworkspaces.UserConfig{
39 OrganizationID: uuid.Nil,
40 Username: "test",
41 Email: "test@test.coder.com",
42 },
43 errContains: "organization_id must not be a nil UUID",
44 },
45 {
46 name: "OKSessionToken",
47 config: createworkspaces.UserConfig{
48 OrganizationID: id,
49 SessionToken: "sometoken",
50 },
51 },
52 {
53 name: "WithSessionTokenAndUsername",
54 config: createworkspaces.UserConfig{
55 OrganizationID: id,
56 Username: "test",
57 SessionToken: "sometoken",
58 },
59 errContains: "username must be empty when session_token is set",
60 },
61 {
62 name: "WithSessionTokenAndEmail",
63 config: createworkspaces.UserConfig{
64 OrganizationID: id,
65 Email: "test@test.coder.com",
66 SessionToken: "sometoken",
67 },
68 errContains: "email must be empty when session_token is set",
69 },
70 }
71
72 for _, c := range cases {
73 t.Run(c.name, func(t *testing.T) {
74 t.Parallel()
75

Callers

nothing calls this directly

Calls 5

NewMethod · 0.65
RunMethod · 0.65
ValidateMethod · 0.65
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected