MCPcopy Create free account
hub / github.com/facebook/time / TestFetchSettings

Function TestFetchSettings

calnex/api/api_test.go:313–329  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

311}
312
313func TestFetchSettings(t *testing.T) {
314 sampleResp := "[measure]\nch0\\synce_enabled=Off\n"
315 ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter,
316 r *http.Request) {
317 fmt.Fprintln(w, sampleResp)
318 }))
319 defer ts.Close()
320
321 parsed, _ := url.Parse(ts.URL)
322 calnexAPI, err := NewAPI(parsed.Host, true, time.Second)
323 require.NoError(t, err)
324 calnexAPI.Client = ts.Client()
325
326 f, err := calnexAPI.FetchSettings()
327 require.NoError(t, err)
328 require.Equal(t, f.Section("measure").Key("ch0\\synce_enabled").Value(), OFF)
329}
330
331func TestFetchStatus(t *testing.T) {
332 sampleResp := "{\"channelLinksReady\":true,\"ipAddressReady\":true,\"measurementActive\":true,\"measurementReady\":true,\"modulesReady\":true,\"referenceReady\":true}"

Callers

nothing calls this directly

Calls 4

FetchSettingsMethod · 0.95
NewAPIFunction · 0.85
ValueMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…