MCPcopy Create free account
hub / github.com/cli/cli / TestActionsFeatures

Function TestActionsFeatures

internal/featuredetection/feature_detection_test.go:821–887  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

819}
820
821func TestActionsFeatures(t *testing.T) {
822 tests := []struct {
823 name string
824 hostname string
825 httpStubs func(*httpmock.Registry)
826 wantFeatures ActionsFeatures
827 }{
828 {
829 name: "github.com, workflow dispatch run details supported",
830 hostname: "github.com",
831 wantFeatures: ActionsFeatures{
832 DispatchRunDetails: true,
833 },
834 },
835 {
836 name: "ghec data residency (ghe.com), workflow dispatch run details supported",
837 hostname: "stampname.ghe.com",
838 wantFeatures: ActionsFeatures{
839 DispatchRunDetails: true,
840 },
841 },
842 {
843 name: "GHE 3.20, workflow dispatch run details not supported",
844 hostname: "git.my.org",
845 httpStubs: func(reg *httpmock.Registry) {
846 reg.Register(
847 httpmock.REST("GET", "api/v3/meta"),
848 httpmock.StringResponse(`{"installed_version":"3.20.999"}`),
849 )
850 },
851 wantFeatures: ActionsFeatures{
852 DispatchRunDetails: false,
853 },
854 },
855 {
856 name: "GHE 3.21, workflow dispatch run details supported",
857 hostname: "git.my.org",
858 httpStubs: func(reg *httpmock.Registry) {
859 reg.Register(
860 httpmock.REST("GET", "api/v3/meta"),
861 httpmock.StringResponse(`{"installed_version":"3.21.0"}`),
862 )
863 },
864 wantFeatures: ActionsFeatures{
865 DispatchRunDetails: true,
866 },
867 },
868 }
869
870 for _, tt := range tests {
871 t.Run(tt.name, func(t *testing.T) {
872 t.Parallel()
873 reg := &httpmock.Registry{}
874 if tt.httpStubs != nil {
875 tt.httpStubs(reg)
876 }
877 httpClient := &http.Client{}
878 httpmock.ReplaceTripper(httpClient, reg)

Callers

nothing calls this directly

Calls 8

RegisterMethod · 0.95
ActionsFeaturesMethod · 0.95
RESTFunction · 0.92
StringResponseFunction · 0.92
ReplaceTripperFunction · 0.92
NewDetectorFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected