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

Function TestCodespacesService_GetPublicKey

github/codespaces_secrets_test.go:399–491  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

397}
398
399func TestCodespacesService_GetPublicKey(t *testing.T) {
400 t.Parallel()
401 type test struct {
402 name string
403 handleFunc func(*http.ServeMux)
404 call func(context.Context, *Client) (*PublicKey, *Response, error)
405 badCall func(context.Context, *Client) (*PublicKey, *Response, error)
406 methodName string
407 }
408
409 tests := []*test{
410 {
411 name: "User",
412 handleFunc: func(mux *http.ServeMux) {
413 mux.HandleFunc("/user/codespaces/secrets/public-key", func(w http.ResponseWriter, r *http.Request) {
414 testMethod(t, r, "GET")
415 fmt.Fprint(w, `{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`)
416 })
417 },
418 call: func(ctx context.Context, client *Client) (*PublicKey, *Response, error) {
419 return client.Codespaces.GetUserPublicKey(ctx)
420 },
421 methodName: "GetUserPublicKey",
422 },
423 {
424 name: "Org",
425 handleFunc: func(mux *http.ServeMux) {
426 mux.HandleFunc("/orgs/o/codespaces/secrets/public-key", func(w http.ResponseWriter, r *http.Request) {
427 testMethod(t, r, "GET")
428 fmt.Fprint(w, `{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`)
429 })
430 },
431 call: func(ctx context.Context, client *Client) (*PublicKey, *Response, error) {
432 return client.Codespaces.GetOrgPublicKey(ctx, "o")
433 },
434 badCall: func(ctx context.Context, client *Client) (*PublicKey, *Response, error) {
435 return client.Codespaces.GetOrgPublicKey(ctx, "\n")
436 },
437 methodName: "GetOrgPublicKey",
438 },
439 {
440 name: "Repo",
441 handleFunc: func(mux *http.ServeMux) {
442 mux.HandleFunc("/repos/o/r/codespaces/secrets/public-key", func(w http.ResponseWriter, r *http.Request) {
443 testMethod(t, r, "GET")
444 fmt.Fprint(w, `{"key_id":"1234","key":"2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"}`)
445 })
446 },
447 call: func(ctx context.Context, client *Client) (*PublicKey, *Response, error) {
448 return client.Codespaces.GetRepoPublicKey(ctx, "o", "r")
449 },
450 badCall: func(ctx context.Context, client *Client) (*PublicKey, *Response, error) {
451 return client.Codespaces.GetRepoPublicKey(ctx, "\n", "\n")
452 },
453 methodName: "GetRepoPublicKey",
454 },
455 }
456

Callers

nothing calls this directly

Calls 10

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
GetUserPublicKeyMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetOrgPublicKeyMethod · 0.45
GetRepoPublicKeyMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…