(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func 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 | |
| 56 | func Test_ListOAuthApps(t *testing.T) { |
| 57 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…