File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -952,6 +952,49 @@ describe('Pubnub', function () {
952
952
} , 5000 ) ;
953
953
} ) ;
954
954
955
+ it ( 'should be able to grant read write access for wildcard channel' , function ( done ) {
956
+ var auth_key = "abcd" ;
957
+ var grant_channel_local = grant_channel + "-" + Date . now ( ) + "." ;
958
+ setTimeout ( function ( ) {
959
+ pubnub . grant ( {
960
+ channel : grant_channel_local + "*" ,
961
+ 'auth_key' : auth_key ,
962
+ read : true ,
963
+ write : true ,
964
+ callback : function ( ) {
965
+ pubnub . audit ( {
966
+ channel : grant_channel_local + "*" ,
967
+ 'auth_key' : auth_key ,
968
+ callback : function ( response ) {
969
+ assert . deepEqual ( response . auths [ auth_key ] . r , 1 ) ;
970
+ assert . deepEqual ( response . auths [ auth_key ] . w , 1 ) ;
971
+ pubnub . history ( {
972
+ 'channel' : grant_channel_local + "a" ,
973
+ 'auth_key' : auth_key ,
974
+ 'callback' : function ( ) {
975
+ pubnub . publish ( {
976
+ 'channel' : grant_channel_local + "a" ,
977
+ 'auth_key' : auth_key ,
978
+ 'message' : 'Test' ,
979
+ 'callback' : function ( ) {
980
+ done ( ) ;
981
+ } ,
982
+ 'error' : function ( ) {
983
+ done ( new Error ( "Unable to publish to granted channel" ) ) ;
984
+ }
985
+ } )
986
+ } ,
987
+ 'error' : function ( ) {
988
+ done ( new Error ( "Unable to get history of granted channel" ) ) ;
989
+ }
990
+ } ) ;
991
+ }
992
+ } ) ;
993
+ }
994
+ } )
995
+ } , 5000 ) ;
996
+ } ) ;
997
+
955
998
it ( 'should be able to grant read write access without auth key' , function ( done ) {
956
999
var grant_channel_local = grant_channel + Date . now ( ) ;
957
1000
setTimeout ( function ( ) {
You can’t perform that action at this time.
0 commit comments