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

Function TestCopilotService_DownloadCopilotMetrics

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

Source from the content-addressed store, hash-verified

2928}
2929
2930func 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 {

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…