(t *testing.T)
| 2928 | } |
| 2929 | |
| 2930 | func TestCopilotService_DownloadCopilotMetrics(t *testing.T) { |
| 2931 | t.Parallel() |
| 2932 | client, mux, _ := setup(t) |
| 2933 | |
| 2934 | mux.HandleFunc("/path/to/download", func(w http.ResponseWriter, r *http.Request) { |
| 2935 | testMethod(t, r, "GET") |
| 2936 | fmt.Fprint(w, `[{ |
| 2937 | "date": "2023-01-01", |
| 2938 | "total_active_users": 100, |
| 2939 | "total_engaged_users": 50, |
| 2940 | "copilot_ide_code_completions": { |
| 2941 | "total_engaged_users": 50, |
| 2942 | "languages": [ |
| 2943 | { |
| 2944 | "name": "go", |
| 2945 | "total_engaged_users": 10 |
| 2946 | } |
| 2947 | ], |
| 2948 | "editors": [ |
| 2949 | { |
| 2950 | "name": "vscode", |
| 2951 | "total_engaged_users": 10, |
| 2952 | "models": [ |
| 2953 | { |
| 2954 | "name": "model1", |
| 2955 | "is_custom_model": false, |
| 2956 | "custom_model_training_date": null, |
| 2957 | "total_engaged_users": 10, |
| 2958 | "languages": [ |
| 2959 | { |
| 2960 | "name": "go", |
| 2961 | "total_engaged_users": 10, |
| 2962 | "total_code_suggestions": 100, |
| 2963 | "total_code_acceptances": 50, |
| 2964 | "total_code_lines_suggested": 1000, |
| 2965 | "total_code_lines_accepted": 500 |
| 2966 | } |
| 2967 | ] |
| 2968 | } |
| 2969 | ] |
| 2970 | } |
| 2971 | ] |
| 2972 | } |
| 2973 | }]`) |
| 2974 | }) |
| 2975 | |
| 2976 | ctx := t.Context() |
| 2977 | url := client.baseURL.String() + "path/to/download" |
| 2978 | got, resp, err := client.Copilot.DownloadCopilotMetrics(ctx, url) |
| 2979 | if err != nil { |
| 2980 | t.Errorf("Copilot.DownloadCopilotMetrics returned error: %v", err) |
| 2981 | } |
| 2982 | if resp.StatusCode != http.StatusOK { |
| 2983 | t.Errorf("Copilot.DownloadCopilotMetrics returned status code: %v", resp.StatusCode) |
| 2984 | } |
| 2985 | |
| 2986 | want := []*CopilotMetrics{ |
| 2987 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…