MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestAccountCurrentTextUsesCommandOutput

Function TestAccountCurrentTextUsesCommandOutput

cmd/account_test.go:16–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestAccountCurrentTextUsesCommandOutput(t *testing.T) {
17 cmd, stdout := testAccountCmd()
18 setCurrentAuthContextForTest(t, &authContext{Source: authSourceSaved, Refreshable: true, AuthFile: authFileDefault})
19 stubUsersClient(t, &mockUsersClient{
20 getCurrentAccountFn: func() (*users.FullAccount, error) {
21 return testFullAccount(), nil
22 },
23 })
24
25 if err := account(cmd, nil); err != nil {
26 t.Fatalf("account returned error: %v", err)
27 }
28 output := stdout.String()
29 if !strings.Contains(output, "Logged in as Test User <test@example.com>") {
30 t.Fatalf("stdout = %q, want current account text output", output)
31 }
32 if !strings.Contains(output, "Account Type:") {
33 t.Fatalf("stdout = %q, want account type", output)
34 }
35 if !strings.Contains(output, "Auth:") || !strings.Contains(output, "Source: saved credentials") || !strings.Contains(output, "Refreshable: true") || !strings.Contains(output, "Auth File: default") {
36 t.Fatalf("stdout = %q, want auth context", output)
37 }
38 if !strings.Contains(output, "Profile Photo URL:") {
39 t.Fatalf("stdout = %q, want Profile Photo URL label", output)
40 }
41 if strings.Contains(output, "Profile Photo Url:") {
42 t.Fatalf("stdout = %q, want URL acronym casing", output)
43 }
44 if strings.Contains(output, "Acting As:") {
45 t.Fatalf("stdout = %q, want no Acting As section", output)
46 }
47}
48
49func TestAccountCurrentJSONOutputsAccount(t *testing.T) {
50 cmd, stdout := testAccountCmd()

Callers

nothing calls this directly

Calls 5

testAccountCmdFunction · 0.85
stubUsersClientFunction · 0.85
testFullAccountFunction · 0.85
accountFunction · 0.85

Tested by

no test coverage detected