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

Function TestCodespacesService_Stop

github/codespaces_test.go:233–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

231}
232
233func TestCodespacesService_Stop(t *testing.T) {
234 t.Parallel()
235 client, mux, _ := setup(t)
236
237 mux.HandleFunc("/user/codespaces/codespace_1/stop", func(w http.ResponseWriter, r *http.Request) {
238 testMethod(t, r, "POST")
239 fmt.Fprint(w, `{"id":1, "repository": {"id": 1296269}}`)
240 })
241 ctx := t.Context()
242 codespace, _, err := client.Codespaces.Stop(ctx, "codespace_1")
243 if err != nil {
244 t.Errorf("Codespaces.Stop returned error: %v", err)
245 }
246 want := &Codespace{
247 ID: Ptr(int64(1)),
248 Repository: &Repository{
249 ID: Ptr(int64(1296269)),
250 },
251 }
252
253 if !cmp.Equal(codespace, want) {
254 t.Errorf("Codespaces.Stop returned %+v, want %+v", codespace, want)
255 }
256
257 const methodName = "Stop"
258 testBadOptions(t, methodName, func() (err error) {
259 _, _, err = client.Codespaces.Stop(ctx, "\n")
260 return err
261 })
262
263 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
264 got, resp, err := client.Codespaces.Stop(ctx, "o")
265 if got != nil {
266 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
267 }
268 return resp, err
269 })
270}
271
272func TestCodespacesService_Delete(t *testing.T) {
273 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
StopMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…