88 "encoding/json"
99 "os"
1010 "path/filepath"
11+ "reflect"
1112 "strings"
1213 "testing"
1314
@@ -17,23 +18,19 @@ import (
1718)
1819
1920func TestSlidesScreenshotDeclaredScopes (t * testing.T ) {
20- if got := SlidesScreenshot .ScopesForIdentity ("user" ); len (got ) != 0 {
21- t .Fatalf ("user preflight scopes = %#v, want empty" , got )
21+ base := []string {"slides:presentation:screenshot" }
22+ if got := SlidesScreenshot .ScopesForIdentity ("user" ); ! reflect .DeepEqual (got , base ) {
23+ t .Fatalf ("user preflight scopes = %#v, want %#v" , got , base )
2224 }
23- if got := SlidesScreenshot .ScopesForIdentity ("bot" ); len (got ) != 0 {
24- t .Fatalf ("bot preflight scopes = %#v, want empty " , got )
25+ if got := SlidesScreenshot .ScopesForIdentity ("bot" ); ! reflect . DeepEqual (got , base ) {
26+ t .Fatalf ("bot preflight scopes = %#v, want %#v " , got , base )
2527 }
2628
2729 got := SlidesScreenshot .DeclaredScopesForIdentity ("user" )
28- want := []string {"wiki:node:read" }
29- if len ( got ) != len ( want ) || got [ 0 ] != want [ 0 ] {
30+ want := []string {"slides:presentation:screenshot" , " wiki:node:read" }
31+ if ! reflect . DeepEqual ( got , want ) {
3032 t .Fatalf ("declared scopes = %#v, want %#v" , got , want )
3133 }
32- for _ , scope := range got {
33- if scope == "slides:presentation:screenshot" {
34- t .Fatalf ("declared scopes must not advertise screenshot scope: %#v" , got )
35- }
36- }
3734}
3835
3936func TestSlidesScreenshotWritesFilesAndSuppressesBase64 (t * testing.T ) {
0 commit comments