MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetGitHubHost

Function TestGetGitHubHost

pkg/cli/github_test.go:9–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestGetGitHubHost(t *testing.T) {
10 tests := []struct {
11 name string
12 serverURL string
13 enterpriseHost string
14 githubHost string
15 ghHost string
16 expectedHost string
17 }{
18 {
19 name: "defaults to github.com",
20 serverURL: "",
21 enterpriseHost: "",
22 githubHost: "",
23 ghHost: "",
24 expectedHost: "https://github.com",
25 },
26 {
27 name: "uses GITHUB_SERVER_URL when set",
28 serverURL: "https://github.enterprise.com",
29 enterpriseHost: "",
30 githubHost: "",
31 ghHost: "",
32 expectedHost: "https://github.enterprise.com",
33 },
34 {
35 name: "uses GITHUB_ENTERPRISE_HOST when GITHUB_SERVER_URL not set",
36 serverURL: "",
37 enterpriseHost: "github.enterprise.com",
38 githubHost: "",
39 ghHost: "",
40 expectedHost: "https://github.enterprise.com",
41 },
42 {
43 name: "uses GITHUB_HOST when GITHUB_SERVER_URL and GITHUB_ENTERPRISE_HOST not set",
44 serverURL: "",
45 enterpriseHost: "",
46 githubHost: "github.company.com",
47 ghHost: "",
48 expectedHost: "https://github.company.com",
49 },
50 {
51 name: "uses GH_HOST when other vars not set",
52 serverURL: "",
53 enterpriseHost: "",
54 githubHost: "",
55 ghHost: "https://github.company.com",
56 expectedHost: "https://github.company.com",
57 },
58 {
59 name: "GITHUB_SERVER_URL takes precedence over all others",
60 serverURL: "https://github.enterprise.com",
61 enterpriseHost: "github.other.com",
62 githubHost: "github.another.com",
63 ghHost: "https://github.company.com",
64 expectedHost: "https://github.enterprise.com",
65 },
66 {

Callers

nothing calls this directly

Calls 4

getGitHubHostFunction · 0.85
SetenvMethod · 0.80
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected