(t *testing.T)
| 888 | } |
| 889 | |
| 890 | func TestActionsFeatures(t *testing.T) { |
| 891 | tests := []struct { |
| 892 | name string |
| 893 | hostname string |
| 894 | httpStubs func(*httpmock.Registry) |
| 895 | wantFeatures ActionsFeatures |
| 896 | }{ |
| 897 | { |
| 898 | name: "github.com, workflow dispatch run details supported", |
| 899 | hostname: "github.com", |
| 900 | wantFeatures: ActionsFeatures{ |
| 901 | DispatchRunDetails: true, |
| 902 | }, |
| 903 | }, |
| 904 | { |
| 905 | name: "ghec data residency (ghe.com), workflow dispatch run details supported", |
| 906 | hostname: "stampname.ghe.com", |
| 907 | wantFeatures: ActionsFeatures{ |
| 908 | DispatchRunDetails: true, |
| 909 | }, |
| 910 | }, |
| 911 | { |
| 912 | name: "GHE 3.20, workflow dispatch run details not supported", |
| 913 | hostname: "git.my.org", |
| 914 | httpStubs: func(reg *httpmock.Registry) { |
| 915 | reg.Register( |
| 916 | httpmock.REST("GET", "api/v3/meta"), |
| 917 | httpmock.StringResponse(`{"installed_version":"3.20.999"}`), |
| 918 | ) |
| 919 | }, |
| 920 | wantFeatures: ActionsFeatures{ |
| 921 | DispatchRunDetails: false, |
| 922 | }, |
| 923 | }, |
| 924 | { |
| 925 | name: "GHE 3.21, workflow dispatch run details supported", |
| 926 | hostname: "git.my.org", |
| 927 | httpStubs: func(reg *httpmock.Registry) { |
| 928 | reg.Register( |
| 929 | httpmock.REST("GET", "api/v3/meta"), |
| 930 | httpmock.StringResponse(`{"installed_version":"3.21.0"}`), |
| 931 | ) |
| 932 | }, |
| 933 | wantFeatures: ActionsFeatures{ |
| 934 | DispatchRunDetails: true, |
| 935 | }, |
| 936 | }, |
| 937 | } |
| 938 | |
| 939 | for _, tt := range tests { |
| 940 | t.Run(tt.name, func(t *testing.T) { |
| 941 | t.Parallel() |
| 942 | reg := &httpmock.Registry{} |
| 943 | if tt.httpStubs != nil { |
| 944 | tt.httpStubs(reg) |
| 945 | } |
| 946 | httpClient := &http.Client{} |
| 947 | httpmock.ReplaceTripper(httpClient, reg) |
nothing calls this directly
no test coverage detected