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

Function TestUpdateOpenAPI

tools/metadata/main_test.go:71–129  ·  view source on GitHub ↗

nolint:paralleltest // cannot use t.Parallel() when helper calls t.Setenv

(t *testing.T)

Source from the content-addressed store, hash-verified

69
70//nolint:paralleltest // cannot use t.Parallel() when helper calls t.Setenv
71func TestUpdateOpenAPI(t *testing.T) {
72 testServer := newTestServer(t, "main", map[string]any{
73 "api.github.com/api.github.com.json": openapi3.T{
74 Paths: openapi3.NewPaths(
75 openapi3.WithPath("/a/{a_id}", &openapi3.PathItem{
76 Get: &openapi3.Operation{
77 ExternalDocs: &openapi3.ExternalDocs{
78 URL: "https://docs.github.com/rest/reference/a",
79 },
80 },
81 })),
82 },
83 "ghec/ghec.json": openapi3.T{
84 Paths: openapi3.NewPaths(
85 openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
86 Get: &openapi3.Operation{
87 ExternalDocs: &openapi3.ExternalDocs{
88 URL: "https://docs.github.com/rest/reference/a",
89 },
90 },
91 })),
92 },
93 "ghes-3.9/ghes-3.9.json": openapi3.T{
94 Paths: openapi3.NewPaths(
95 openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
96 Get: &openapi3.Operation{
97 ExternalDocs: &openapi3.ExternalDocs{
98 URL: "https://docs.github.com/rest/reference/a",
99 },
100 },
101 })),
102 },
103 "ghes-3.10/ghes-3.10.json": openapi3.T{
104 Paths: openapi3.NewPaths(
105 openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
106 Get: &openapi3.Operation{
107 ExternalDocs: &openapi3.ExternalDocs{
108 URL: "https://docs.github.com/rest/reference/a",
109 },
110 },
111 })),
112 },
113 "ghes-2.22/ghes-2.22.json": openapi3.T{
114 Paths: openapi3.NewPaths(
115 openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{
116 Get: &openapi3.Operation{
117 ExternalDocs: &openapi3.ExternalDocs{
118 URL: "https://docs.github.com/rest/reference/a",
119 },
120 },
121 })),
122 },
123 })
124
125 res := runTest(t, "testdata/update-openapi", "update-openapi", "--github-url", testServer.URL)
126 res.assertOutput("", "")
127 res.assertNoErr()
128 res.checkGolden()

Callers

nothing calls this directly

Calls 5

newTestServerFunction · 0.85
runTestFunction · 0.85
assertOutputMethod · 0.80
assertNoErrMethod · 0.80
checkGoldenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…