MCPcopy
hub / github.com/cli/cli / TestActionsFeatures

Function TestActionsFeatures

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

Source from the content-addressed store, hash-verified

785}
786
787func TestActionsFeatures(t *testing.T) {
788 tests := []struct {
789 name string
790 hostname string
791 httpStubs func(*httpmock.Registry)
792 wantFeatures ActionsFeatures
793 }{
794 {
795 name: "github.com, workflow dispatch run details supported",
796 hostname: "github.com",
797 wantFeatures: ActionsFeatures{
798 DispatchRunDetails: true,
799 },
800 },
801 {
802 name: "ghec data residency (ghe.com), workflow dispatch run details supported",
803 hostname: "stampname.ghe.com",
804 wantFeatures: ActionsFeatures{
805 DispatchRunDetails: true,
806 },
807 },
808 {
809 name: "GHE 3.20, workflow dispatch run details not supported",
810 hostname: "git.my.org",
811 httpStubs: func(reg *httpmock.Registry) {
812 reg.Register(
813 httpmock.REST("GET", "api/v3/meta"),
814 httpmock.StringResponse(`{"installed_version":"3.20.999"}`),
815 )
816 },
817 wantFeatures: ActionsFeatures{
818 DispatchRunDetails: false,
819 },
820 },
821 {
822 name: "GHE 3.21, workflow dispatch run details supported",
823 hostname: "git.my.org",
824 httpStubs: func(reg *httpmock.Registry) {
825 reg.Register(
826 httpmock.REST("GET", "api/v3/meta"),
827 httpmock.StringResponse(`{"installed_version":"3.21.0"}`),
828 )
829 },
830 wantFeatures: ActionsFeatures{
831 DispatchRunDetails: true,
832 },
833 },
834 }
835
836 for _, tt := range tests {
837 t.Run(tt.name, func(t *testing.T) {
838 t.Parallel()
839 reg := &httpmock.Registry{}
840 if tt.httpStubs != nil {
841 tt.httpStubs(reg)
842 }
843 httpClient := &http.Client{}
844 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