(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestRunOpenCmd_ResourceShortcutWithAppID(t *testing.T) { |
| 104 | io, _, _, _ := iostreams.Test() |
| 105 | |
| 106 | cfg := test.NewConfigStubWithProfiles([]*config.Profile{ |
| 107 | {Name: "default", ApplicationID: "APP123", APIKey: "key", Default: true}, |
| 108 | }) |
| 109 | |
| 110 | opts, opened, authed := newTestOptions(io, cfg) |
| 111 | opts.Shortcut = "status" |
| 112 | opts.NewDashboardClient = func(string) *dashboard.Client { |
| 113 | return &dashboard.Client{DashboardURL: "https://staging.algolia.test"} |
| 114 | } |
| 115 | |
| 116 | err := runOpenCmd(opts) |
| 117 | require.NoError(t, err) |
| 118 | assert.True(t, *authed, "app-scoped status validates the profile application against the signed-in account") |
| 119 | assert.Equal(t, "https://staging.algolia.test/apps/APP123/monitoring/status", *opened) |
| 120 | } |
| 121 | |
| 122 | func TestRunOpenCmd_ResourceShortcutNoAppUsesDefault(t *testing.T) { |
| 123 | t.Setenv("ALGOLIA_APPLICATION_ID", "") |
nothing calls this directly
no test coverage detected