@@ -84,28 +84,21 @@ describe('MembershipService', function() {
84
84
} ) ;
85
85
86
86
describe ( '#filterRoles' , function ( ) {
87
- it ( 'should filter out system-only roles' , function ( ) {
87
+ // constants.js window.OPENSHIFT_CONSTANTS.MEMBERSHIP_WHITELIST
88
+ it ( 'should filter out roles that do not exist in MEMBERSHIP_WHITELIST' , function ( ) {
88
89
var fakeList = [
89
- // the string 'true' is the only acceptable value for 'authorization.openshift.io/system-only'
90
- { metadata : { name : 'system-only-role' , annotations : { 'authorization.openshift.io/system-only' : 'true' } } } ,
91
- // the rest of these will not be filtered
92
- { metadata : { name : 'system-only-role2' , annotations : { 'authorization.openshift.io/system-only' : 'false' } } } ,
93
- { metadata : { name : 'system-only-role3' , annotations : { 'authorization.openshift.io/system-only' : 'show' } } } ,
94
- { metadata : { name : 'system-only-role4' , annotations : { 'authorization.openshift.io/system-only' : '' } } } ,
95
- { metadata : { name : 'system-only-role5' , annotations : { 'authorization.openshift.io/system-only' : undefined } } } ,
96
- { metadata : { name : 'system-only-role6' , annotations : { 'authorization.openshift.io/system-only' : null } } } ,
97
- { metadata : { name : 'not-system-only' } } ,
98
- { metadata : { name : 'the-other-not-system-only' } }
90
+ { metadata : { name : 'admin' } } ,
91
+ { metadata : { name : 'basic-user' } } ,
92
+ { metadata : { name : 'edit' } } ,
93
+ { metadata : { name : 'not-an-admin' } } ,
94
+ { metadata : { name : 'not-a-basic-user' } } ,
95
+ { metadata : { name : 'system-only-thing-that-does-secret-stuff' } }
99
96
] ;
100
97
101
98
expect ( MembershipService . filterRoles ( fakeList ) ) . toEqual ( [
102
- { metadata : { name : 'system-only-role2' , annotations : { 'authorization.openshift.io/system-only' : 'false' } } } ,
103
- { metadata : { name : 'system-only-role3' , annotations : { 'authorization.openshift.io/system-only' : 'show' } } } ,
104
- { metadata : { name : 'system-only-role4' , annotations : { 'authorization.openshift.io/system-only' : '' } } } ,
105
- { metadata : { name : 'system-only-role5' , annotations : { 'authorization.openshift.io/system-only' : undefined } } } ,
106
- { metadata : { name : 'system-only-role6' , annotations : { 'authorization.openshift.io/system-only' : null } } } ,
107
- { metadata : { name : 'not-system-only' } } ,
108
- { metadata : { name : 'the-other-not-system-only' } }
99
+ { metadata : { name : 'admin' } } ,
100
+ { metadata : { name : 'basic-user' } } ,
101
+ { metadata : { name : 'edit' } }
109
102
] ) ;
110
103
} ) ;
111
104
} ) ;
0 commit comments