@@ -35,23 +35,47 @@ describe('UsersService', () => {
35
35
it ( 'grant role to a User' , ( ) => {
36
36
const userId = 'userId' ;
37
37
const roleId = 'admin' ;
38
+ service . isProduction = true ;
38
39
39
40
service . grantRole ( userId , roleId ) . subscribe ( ) ;
40
41
41
42
const grantRoleRequest = httpMock . expectOne ( `${ service . baseUrl } /${ userId } /roles/${ roleId } /grant` ) ;
42
43
expect ( grantRoleRequest . request . method ) . toBe ( 'POST' ) ;
43
44
} ) ;
44
45
46
+ it ( 'grant role to a User locally' , ( ) => {
47
+ const userId = 'userId' ;
48
+ const roleId = 'admin' ;
49
+ service . isProduction = false ;
50
+
51
+ service . grantRole ( userId , roleId ) . subscribe ( ) ;
52
+
53
+ const grantRoleRequest = httpMock . expectOne ( `${ service . baseUrl } /${ userId } /${ roleId } /grant` ) ;
54
+ expect ( grantRoleRequest . request . method ) . toBe ( 'POST' ) ;
55
+ } ) ;
56
+
45
57
it ( 'revoke role to a User' , ( ) => {
46
58
const userId = 'userId' ;
47
59
const roleId = 'admin' ;
60
+ service . isProduction = true ;
48
61
49
62
service . revokeRole ( userId , roleId ) . subscribe ( ) ;
50
63
51
64
const grantRoleRequest = httpMock . expectOne ( `${ service . baseUrl } /${ userId } /roles/${ roleId } /revoke` ) ;
52
65
expect ( grantRoleRequest . request . method ) . toBe ( 'POST' ) ;
53
66
} ) ;
54
67
68
+ it ( 'revoke role to a User locally' , ( ) => {
69
+ const userId = 'userId' ;
70
+ const roleId = 'admin' ;
71
+ service . isProduction = false ;
72
+
73
+ service . revokeRole ( userId , roleId ) . subscribe ( ) ;
74
+
75
+ const grantRoleRequest = httpMock . expectOne ( `${ service . baseUrl } /${ userId } /${ roleId } /revoke` ) ;
76
+ expect ( grantRoleRequest . request . method ) . toBe ( 'POST' ) ;
77
+ } ) ;
78
+
55
79
it ( 'add user to group' , ( ) => {
56
80
const userId = 'userId' ;
57
81
const group = 'admin' ;
0 commit comments