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

Function TestActionsFeatures

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

Source from the content-addressed store, hash-verified

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