MCPcopy
hub / github.com/cloudfoundry/cli / LoginAs

Function LoginAs

integration/helpers/login.go:59–76  ·  view source on GitHub ↗

LoginAs logs into the CLI with 'cf auth' and the given username and password, retrying up to 3 times on failures.

(username, password string)

Source from the content-addressed store, hash-verified

57// LoginAs logs into the CLI with 'cf auth' and the given username and password,
58// retrying up to 3 times on failures.
59func LoginAs(username, password string) {
60 env := map[string]string{
61 "CF_USERNAME": username,
62 "CF_PASSWORD": password,
63 }
64
65 var session *Session
66
67 for i := 0; i < 3; i++ {
68 session = CFWithEnv(env, "auth")
69 Eventually(session).Should(Exit())
70 if session.ExitCode() == 0 {
71 return
72 }
73 time.Sleep(3 * time.Second)
74 }
75 Expect(session.ExitCode()).To(Equal(0))
76}
77
78// LoginCF logs into the CLI using the username and password from the CF_INT_USERNAME
79// and CF_INT_PASSWORD environment variables, respectively, defaulting to "admin" for

Callers 7

LoginCFFunction · 0.85
SwitchToNoRoleFunction · 0.85
SwitchToOrgRoleFunction · 0.85
SwitchToSpaceRoleFunction · 0.85

Calls 1

CFWithEnvFunction · 0.85

Tested by

no test coverage detected