Skip to content

Commit 3c92d22

Browse files
committed
add test for auth client with encrypted channels
1 parent 9f9be6a commit 3c92d22

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pusher_tests/test_authentication_client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from pusher.authentication_client import AuthenticationClient
1515
from pusher.signature import sign, verify
16+
from pusher.util import ensure_binary
1617

1718
try:
1819
import unittest.mock as mock
@@ -21,6 +22,7 @@
2122

2223

2324
class 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

Comments
 (0)