1818
1919
2020class TestPushNotificationsUsers (unittest .TestCase ):
21- def test_authenticate_user_should_return_token (self ):
21+ def test_generate_token_should_return_token (self ):
2222 user_id = 'user-0001'
2323 pn_client = PushNotifications (
2424 'INSTANCE_ID' ,
2525 'SECRET_KEY'
2626 )
2727
28- token_string = pn_client .authenticate_user (user_id )
28+ token_string = pn_client .generate_token (user_id )
2929
3030 self .assertIsInstance (token_string , six .string_types )
3131 self .assertTrue (len (token_string ) > 0 )
@@ -44,24 +44,24 @@ def test_authenticate_user_should_return_token(self):
4444 self .assertIsNotNone (decoded_token .get ('exp' ))
4545 self .assertTrue (decoded_token .get ('exp' ) > time .time ())
4646
47- def test_authenticate_user_should_fail_if_user_id_not_a_string (self ):
47+ def test_generate_token_should_fail_if_user_id_not_a_string (self ):
4848 user_id = False
4949 pn_client = PushNotifications (
5050 'INSTANCE_ID' ,
5151 'SECRET_KEY'
5252 )
5353 with self .assertRaises (TypeError ) as e :
54- pn_client .authenticate_user (user_id )
54+ pn_client .generate_token (user_id )
5555 self .assertIn ('user_id must be a string' , str (e .exception ))
5656
57- def test_authenticate_user_should_fail_if_user_id_too_long (self ):
57+ def test_generate_token_should_fail_if_user_id_too_long (self ):
5858 user_id = 'A' * 165
5959 pn_client = PushNotifications (
6060 'INSTANCE_ID' ,
6161 'SECRET_KEY'
6262 )
6363 with self .assertRaises (ValueError ) as e :
64- pn_client .authenticate_user (user_id )
64+ pn_client .generate_token (user_id )
6565 self .assertIn ('longer than the maximum of 164 chars' , str (e .exception ))
6666
6767 def test_publish_to_users_should_make_correct_http_request (self ):
0 commit comments