MCPcopy Index your code
hub / github.com/google/go-github / TestCopilotService_DownloadUserDailyMetrics

Function TestCopilotService_DownloadUserDailyMetrics

github/copilot_test.go:3304–3409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3302}
3303
3304func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) {
3305 t.Parallel()
3306 client, mux, _ := setup(t)
3307
3308 mux.HandleFunc("/path/to/users-daily", func(w http.ResponseWriter, r *http.Request) {
3309 testMethod(t, r, "GET")
3310 fmt.Fprint(w, `{"user_id":1,"user_login":"alice","day":"2026-04-01","user_initiated_interaction_count":5,"chat_panel_edit_mode":2,"used_chat":true,"used_cli":true,"used_copilot_code_review_active":true,"totals_by_cli":{"session_count":2,"request_count":2,"prompt_count":1,"last_known_cli_version":{"sampled_at":"2026-04-01T12:30:00Z","cli_version":"1.0.8"}},"totals_by_ide":[{"ide":"vscode","user_initiated_interaction_count":5,"last_known_plugin_version":{"sampled_at":"2026-04-01T12:00:00Z","plugin":"copilot","plugin_version":"1.0.0"},"last_known_ide_version":{"sampled_at":"2026-04-01T12:00:00Z","ide_version":"1.90"}}]}
3311{"user_id":2,"user_login":"bob","day":"2026-04-01","used_agent":true,"used_copilot_code_review_passive":true}
3312`)
3313 })
3314
3315 ctx := t.Context()
3316 url := client.baseURL.String() + "path/to/users-daily"
3317 got, resp, err := client.Copilot.DownloadUserDailyMetrics(ctx, url)
3318 if err != nil {
3319 t.Errorf("Copilot.DownloadUserDailyMetrics returned error: %v", err)
3320 }
3321 if resp.StatusCode != http.StatusOK {
3322 t.Errorf("Copilot.DownloadUserDailyMetrics returned status code: %v", resp.StatusCode)
3323 }
3324
3325 want := []*CopilotUserDailyMetrics{
3326 {
3327 UserID: 1,
3328 UserLogin: "alice",
3329 Day: "2026-04-01",
3330 UserInitiatedInteractionCount: Ptr(5),
3331 CopilotMetricsChatPanel: CopilotMetricsChatPanel{
3332 ChatPanelEditMode: Ptr(2),
3333 },
3334 UsedChat: Ptr(true),
3335 UsedCLI: Ptr(true),
3336 UsedCopilotCodeReviewActive: Ptr(true),
3337 TotalsByCLI: &CopilotMetricsCLI{
3338 SessionCount: Ptr(2),
3339 RequestCount: Ptr(2),
3340 PromptCount: Ptr(1),
3341 LastKnownCLIVersion: &CopilotMetricsCLIVersion{
3342 SampledAt: &Timestamp{time.Date(2026, 4, 1, 12, 30, 0, 0, time.UTC)},
3343 CLIVersion: "1.0.8",
3344 },
3345 },
3346 TotalsByIDE: []*CopilotUserMetricsIDE{
3347 {
3348 IDE: "vscode",
3349 UserInitiatedInteractionCount: Ptr(5),
3350 LastKnownPluginVersion: &CopilotUserMetricsPluginVersion{
3351 SampledAt: &Timestamp{time.Date(2026, 4, 1, 12, 0, 0, 0, time.UTC)},
3352 Plugin: "copilot",
3353 PluginVersion: "1.0.0",
3354 },
3355 LastKnownIDEVersion: &CopilotUserMetricsIDEVersion{
3356 SampledAt: &Timestamp{time.Date(2026, 4, 1, 12, 0, 0, 0, time.UTC)},
3357 IDEVersion: "1.90",
3358 },
3359 },
3360 },
3361 },

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…