(t *testing.T)
| 785 | } |
| 786 | |
| 787 | func 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) |
nothing calls this directly
no test coverage detected