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

Function TestGetApplication_Success

api/dashboard/client_test.go:224–247  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestGetApplication_Success(t *testing.T) {
225 mux := http.NewServeMux()
226 mux.HandleFunc("/1/application/APP1", func(w http.ResponseWriter, r *http.Request) {
227 assert.Equal(t, "Bearer test-token", r.Header.Get("Authorization"))
228 require.NoError(t, json.NewEncoder(w).Encode(SingleApplicationResponse{
229 Data: ApplicationResource{
230 ID: "APP1", Type: "application",
231 Attributes: ApplicationAttributes{
232 ApplicationID: "APP1",
233 Name: "My App",
234 APIKey: "api-key-123",
235 },
236 },
237 }))
238 })
239
240 ts, client := newTestClient(mux)
241 defer ts.Close()
242
243 app, err := client.GetApplication("test-token", "APP1")
244 require.NoError(t, err)
245 assert.Equal(t, "APP1", app.ID)
246 assert.Equal(t, "api-key-123", app.APIKey)
247}
248
249func TestGetApplication_ParsesPlanLabel(t *testing.T) {
250 mux := http.NewServeMux()

Callers

nothing calls this directly

Calls 4

newTestClientFunction · 0.85
GetMethod · 0.80
GetApplicationMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected