(t *testing.T)
| 3064 | } |
| 3065 | |
| 3066 | func TestCopilotService_DownloadDailyMetrics(t *testing.T) { |
| 3067 | t.Parallel() |
| 3068 | client, mux, _ := setup(t) |
| 3069 | |
| 3070 | mux.HandleFunc("/path/to/daily", func(w http.ResponseWriter, r *http.Request) { |
| 3071 | testMethod(t, r, "GET") |
| 3072 | fmt.Fprint(w, `{ |
| 3073 | "day": "2026-04-01", |
| 3074 | "organization_id": "123", |
| 3075 | "daily_active_cli_users": 2, |
| 3076 | "daily_active_users": 10, |
| 3077 | "weekly_active_users": 20, |
| 3078 | "monthly_active_users": 30, |
| 3079 | "chat_panel_ask_mode": 4, |
| 3080 | "totals_by_ide": [ |
| 3081 | {"ide": "vscode", "user_initiated_interaction_count": 5, "loc_added_sum": 100} |
| 3082 | ], |
| 3083 | "totals_by_feature": [ |
| 3084 | {"feature": "completion", "user_initiated_interaction_count": 5}, |
| 3085 | {"feature": "agent_edit", "loc_added_sum": 7, "loc_deleted_sum": 2} |
| 3086 | ], |
| 3087 | "totals_by_language_feature": [ |
| 3088 | {"language": "go", "feature": "completion", "code_generation_activity_count": 3} |
| 3089 | ], |
| 3090 | "totals_by_language_model": [ |
| 3091 | {"language": "go", "model": "m1", "code_generation_activity_count": 3} |
| 3092 | ], |
| 3093 | "totals_by_model_feature": [ |
| 3094 | {"model": "m1", "feature": "completion", "user_initiated_interaction_count": 5} |
| 3095 | ], |
| 3096 | "totals_by_cli": { |
| 3097 | "session_count": 3, |
| 3098 | "request_count": 4, |
| 3099 | "prompt_count": 2, |
| 3100 | "token_usage": { |
| 3101 | "avg_tokens_per_request": 4123.5, |
| 3102 | "output_tokens_sum": 7000, |
| 3103 | "prompt_tokens_sum": 9494 |
| 3104 | } |
| 3105 | }, |
| 3106 | "loc_added_sum": 100, |
| 3107 | "pull_requests": { |
| 3108 | "total_reviewed": 1, |
| 3109 | "total_created": 2, |
| 3110 | "median_minutes_to_merge": 12.5, |
| 3111 | "median_minutes_to_merge_copilot_authored": 4.5, |
| 3112 | "median_minutes_to_merge_copilot_reviewed": 6.5 |
| 3113 | } |
| 3114 | }`) |
| 3115 | }) |
| 3116 | |
| 3117 | ctx := t.Context() |
| 3118 | url := client.baseURL.String() + "path/to/daily" |
| 3119 | got, resp, err := client.Copilot.DownloadDailyMetrics(ctx, url) |
| 3120 | if err != nil { |
| 3121 | t.Errorf("Copilot.DownloadDailyMetrics returned error: %v", err) |
| 3122 | } |
| 3123 | if resp.StatusCode != http.StatusOK { |
nothing calls this directly
no test coverage detected
searching dependent graphs…