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

Function login

cli/logout_test.go:169–191  ·  view source on GitHub ↗
(t *testing.T, pty *ptytest.PTY)

Source from the content-addressed store, hash-verified

167}
168
169func login(t *testing.T, pty *ptytest.PTY) config.Root {
170 t.Helper()
171
172 client := coderdtest.New(t, nil)
173 coderdtest.CreateFirstUser(t, client)
174
175 doneChan := make(chan struct{})
176 root, cfg := clitest.New(t, "login", "--force-tty", client.URL.String(), "--no-open")
177 root.Stdin = pty.Input()
178 root.Stdout = pty.Output()
179 go func() {
180 defer close(doneChan)
181 err := root.Run()
182 assert.NoError(t, err)
183 }()
184
185 pty.ExpectMatch("Paste your token here:")
186 pty.WriteLine(client.SessionToken())
187 pty.ExpectMatch("Welcome to Coder")
188 <-doneChan
189
190 return cfg
191}

Callers 2

TestLogoutFunction · 0.70
TestNetcheckFunction · 0.70

Calls 11

NewFunction · 0.92
CreateFirstUserFunction · 0.92
NewFunction · 0.92
WriteLineMethod · 0.80
HelperMethod · 0.65
InputMethod · 0.65
OutputMethod · 0.65
RunMethod · 0.65
StringMethod · 0.45
ExpectMatchMethod · 0.45
SessionTokenMethod · 0.45

Tested by

no test coverage detected