MCPcopy Index your code
hub / github.com/google/go-github / TestMetaService_Get

Function TestMetaService_Get

github/meta_test.go:69–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestMetaService_Get(t *testing.T) {
70 t.Parallel()
71 client, mux, _ := setup(t)
72
73 mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
74 testMethod(t, r, "GET")
75 fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "actions_macos": ["example.com/1", "example.com/2"], "codespaces": ["cs"], "copilot": ["c"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"actions_inbound": { "full_domains": ["github.com"], "wildcard_domains": ["*.github.com"]},"website":["*.github.com","*.github.dev","*.github.io","*.example.com/assets","*.example.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.github.com","tuf-repo.github.com","fulcio.github.com","timestamp.github.com"]}}}`)
76 })
77
78 ctx := t.Context()
79 meta, _, err := client.Meta.Get(ctx)
80 if err != nil {
81 t.Errorf("Get returned error: %v", err)
82 }
83
84 want := &APIMeta{
85 Hooks: []string{"h"},
86 Git: []string{"g"},
87 Pages: []string{"p"},
88 Importer: []string{"i"},
89 GithubEnterpriseImporter: []string{"gei"},
90 Actions: []string{"a"},
91 ActionsMacos: []string{"example.com/1", "example.com/2"},
92 Codespaces: []string{"cs"},
93 Copilot: []string{"c"},
94 Dependabot: []string{"d"},
95 API: []string{"a"},
96 Web: []string{"w"},
97 Domains: &APIMetaDomains{
98 Website: []string{
99 "*.github.com",
100 "*.github.dev",
101 "*.github.io",
102 "*.example.com/assets",
103 "*.example.com",
104 },
105 ArtifactAttestations: &APIMetaArtifactAttestations{
106 TrustDomain: "",
107 Services: []string{
108 "*.actions.github.com",
109 "tuf-repo.github.com",
110 "fulcio.github.com",
111 "timestamp.github.com",
112 },
113 },
114 ActionsInbound: &ActionsInboundDomains{
115 FullDomains: []string{"github.com"},
116 WildcardDomains: []string{"*.github.com"},
117 },
118 },
119
120 VerifiablePasswordAuthentication: Ptr(true),
121 }
122 if !cmp.Equal(want, meta) {
123 t.Errorf("Get returned %+v, want %+v", meta, want)
124 }
125
126 const methodName = "Get"

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…