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

Function Test_AppRestrictionsEnabled

scrape/apps_test.go:16–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func Test_AppRestrictionsEnabled(t *testing.T) {
17 t.Parallel()
18 tests := []struct {
19 description string
20 testFile string
21 org string
22 want bool
23 }{
24 {
25 description: "return true for enabled orgs",
26 testFile: "access-restrictions-enabled.html",
27 want: true,
28 },
29 {
30 description: "return false for disabled orgs",
31 testFile: "access-restrictions-disabled.html",
32 want: false,
33 },
34 }
35
36 for _, tt := range tests {
37 t.Run(tt.description, func(t *testing.T) {
38 t.Parallel()
39 client, mux := setup(t)
40
41 mux.HandleFunc("/organizations/o/settings/oauth_application_policy", func(w http.ResponseWriter, _ *http.Request) {
42 copyTestFile(t, w, tt.testFile)
43 })
44
45 got, err := client.AppRestrictionsEnabled("o")
46 if err != nil {
47 t.Fatalf("AppRestrictionsEnabled returned err: %v", err)
48 }
49 if want := tt.want; got != want {
50 t.Errorf("AppRestrictionsEnabled returned %t, want %t", got, want)
51 }
52 })
53 }
54}
55
56func Test_ListOAuthApps(t *testing.T) {
57 t.Parallel()

Callers

nothing calls this directly

Calls 4

copyTestFileFunction · 0.85
setupFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…