1313
1414from pusher .authentication_client import AuthenticationClient
1515from pusher .signature import sign , verify
16+ from pusher .util import ensure_binary
1617
1718try :
1819 import unittest .mock as mock
2122
2223
2324class TestAuthenticationClient (unittest .TestCase ):
25+
2426 def test_authenticate_for_private_channels (self ):
2527 authenticationClient = AuthenticationClient (
2628 key = u'foo' , secret = u'bar' , host = u'host' , app_id = u'4' , ssl = True )
@@ -31,6 +33,17 @@ def test_authenticate_for_private_channels(self):
3133
3234 self .assertEqual (authenticationClient .authenticate (u'private-channel' , u'345.23' ), expected )
3335
36+ def test_authenticate_for_private_encrypted_channels (self ):
37+ encryp_master_key = u'8tW5FQLniQ1sBQFwrw7t6TVEsJZd10yY'
38+ authenticationClient = AuthenticationClient (
39+ key = u'foo' , secret = u'bar' , host = u'host' , app_id = u'4' , encryption_master_key = encryp_master_key , ssl = True )
40+
41+ expected = {
42+ u'auth' : u'foo:fff0503dfe4929f5162efe4d1dacbce524b0d8e7e1331117a8651c0e74d369e3' ,
43+ u'shared_secret' : b'VmIsNZtCSteh8kazd2toc+ofhohBtUouQRSDtRvuyVI='
44+ }
45+
46+ self .assertEqual (authenticationClient .authenticate (u'private-encrypted-channel' , u'345.23' ), expected )
3447
3548 def test_authenticate_types (self ):
3649 authenticationClient = AuthenticationClient (
0 commit comments