MCPcopy Create free account
hub / github.com/google/go-github / TestAppsService_CreateInstallationTokenWithOptions

Function TestAppsService_CreateInstallationTokenWithOptions

github/apps_test.go:438–467  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

436}
437
438func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) {
439 t.Parallel()
440 client, mux, _ := setup(t)
441
442 installationTokenOptions := &InstallationTokenOptions{
443 RepositoryIDs: []int64{1234},
444 Repositories: []string{"foo"},
445 Permissions: &InstallationPermissions{
446 Contents: Ptr("write"),
447 Issues: Ptr("read"),
448 },
449 }
450
451 mux.HandleFunc("/app/installations/1/access_tokens", func(w http.ResponseWriter, r *http.Request) {
452 testMethod(t, r, "POST")
453 testJSONBody(t, r, installationTokenOptions)
454 fmt.Fprint(w, `{"token":"t"}`)
455 })
456
457 ctx := t.Context()
458 token, _, err := client.Apps.CreateInstallationToken(ctx, 1, installationTokenOptions)
459 if err != nil {
460 t.Errorf("Apps.CreateInstallationToken returned error: %v", err)
461 }
462
463 want := &InstallationToken{Token: Ptr("t")}
464 if !cmp.Equal(token, want) {
465 t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want)
466 }
467}
468
469func TestAppsService_CreateInstallationTokenListReposWithOptions(t *testing.T) {
470 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
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…