def test_refresh_user_token(self, mock_refresh_request): # mock user social data as mock token data mock_user_social = mock.MagicMock() mock_user_social.extra_data.get.return_value = int(time.time()) # call the method to test hs_client_init_exception.refresh_user_token(mock_user_social) mock_user_social.extra_data.get.assert_called_once_with('expires_at') mock_refresh_request.assert_called_once_with(mock_user_social)
def test_refresh_user_token_exception_1(self, mock_refresh_request): # mock user social data as mock token data mock_user_social = mock.MagicMock() mock_user_social.extra_data.get.side_effect = Exception # call the method to test hs_client_init_exception.refresh_user_token(mock_user_social) mock_user_social.extra_data.get.assert_called_once_with('expires_at') mock_refresh_request.assert_called_once_with(mock_user_social)