@@ -16,10 +16,9 @@ def test_validate_user_id(self):
16
16
pusher .util .validate_user_id (user_id )
17
17
18
18
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" ]
21
20
22
- invalid_channels = ["#123" , "x" * 201 , "abc%&*" ]
21
+ invalid_channels = ["#123" , "x" * 201 , "abc%&*" , "#server-to-user1234" , "#server-to-users" ]
23
22
24
23
for channel in valid_channels :
25
24
self .assertEqual (channel , pusher .util .validate_channel (channel ))
@@ -29,14 +28,14 @@ def test_validate_channel(self):
29
28
pusher .util .validate_channel (invalid_channel )
30
29
31
30
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" ))
32
34
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 ))
38
35
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" )
40
39
41
40
42
41
if __name__ == '__main__' :
0 commit comments