MCPcopy Create free account
hub / github.com/algolia/cli / TestRunOpenCmd_ResourceShortcutWithAppID

Function TestRunOpenCmd_ResourceShortcutWithAppID

pkg/cmd/open/open_test.go:103–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func 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
122func TestRunOpenCmd_ResourceShortcutNoAppUsesDefault(t *testing.T) {
123 t.Setenv("ALGOLIA_APPLICATION_ID", "")

Callers

nothing calls this directly

Calls 4

TestFunction · 0.92
newTestOptionsFunction · 0.85
runOpenCmdFunction · 0.85

Tested by

no test coverage detected