@@ -16,10 +16,9 @@ def test_validate_user_id(self):
1616 pusher .util .validate_user_id (user_id )
1717
1818 def test_validate_channel (self ):
19- valid_channels = ["123" , "xyz" , "xyz123" , "xyz_123" , "xyz-123" , "Channel@123" , "channel_xyz" , "channel-xyz" ,
20- "channel,456" ,
"channel;asd" ,
"[email protected] ,987;654" ]
19+ valid_channels = [
"123" ,
"xyz" ,
"xyz123" ,
"xyz_123" ,
"xyz-123" ,
"Channel@123" ,
"channel_xyz" ,
"channel-xyz" ,
"channel,456" ,
"channel;asd" ,
"[email protected] ,987;654" ]
2120
22- invalid_channels = ["#123" , "x" * 201 , "abc%&*" ]
21+ invalid_channels = ["#123" , "x" * 201 , "abc%&*" , "#server-to-user1234" , "#server-to-users" ]
2322
2423 for channel in valid_channels :
2524 self .assertEqual (channel , pusher .util .validate_channel (channel ))
@@ -29,14 +28,14 @@ def test_validate_channel(self):
2928 pusher .util .validate_channel (invalid_channel )
3029
3130 def test_validate_server_to_user_channel (self ):
31+ self .assertEqual ("#server-to-user-123" , pusher .util .validate_channel ("#server-to-user-123" ))
32+ self .assertEqual ("#server-to-user-user123" , pusher .util .validate_channel ("#server-to-user-user123" ))
33+ self .assertEqual ("#server-to-user-ID-123" , pusher .util .validate_channel ("#server-to-user-ID-123" ))
3234
33- valid_server_to_user_channel = "#server-to-user-123"
34-
35- invalid_server_to_user_channel = "#server-to-useR-123"
36-
37- self .assertEqual (valid_server_to_user_channel , pusher .util .validate_channel (valid_server_to_user_channel ))
3835 with self .assertRaises (ValueError ):
39- pusher .util .validate_channel (invalid_server_to_user_channel )
36+ pusher .util .validate_channel ("#server-to-useR-123" )
37+ pusher .util .validate_channel ("#server-to-user1234" )
38+ pusher .util .validate_channel ("#server-to-users" )
4039
4140
4241if __name__ == '__main__' :
0 commit comments