# Path: ingenico/connect/sdk/communicator_configuration.py
# class CommunicatorConfiguration(EndpointConfiguration):
#     """
#     Configuration for the communicator.
# 
#     :param properties: a ConfigParser.ConfigParser object containing configuration data
#     :param connect_timeout: connection timeout for the network communication in seconds
#     :param socket_timeout: socket timeout for the network communication in seconds
#     :param max_connections: The maximum number of connections in the connection pool
#     """
#     __api_key_id = None
#     __secret_api_key = None
# 
#     def __init__(self, properties=None, api_endpoint=False, api_key_id=False,
#                  secret_api_key=False, authorization_type=False,
#                  connect_timeout=False, socket_timeout=False,
#                  max_connections=False, proxy_configuration=False,
#                  integrator=False, shopping_cart_extension=False):
#         if properties:
#             super(CommunicatorConfiguration, self).__init__(properties,
#                                                             "connect.api")
#             if properties.sections() and properties.options("ConnectSDK"):
#                 authorization = properties.get("ConnectSDK",
#                                                "connect.api.authorizationType")
#                 self.__authorization_type = AuthorizationType.get_authorization(
#                     authorization)
#         if api_endpoint:
#             self.api_endpoint = api_endpoint
#         if api_key_id:
#             self.api_key_id = api_key_id
#         if secret_api_key:
#             self.secret_api_key = secret_api_key
#         if authorization_type:
#             self.authorization_type = authorization_type
#         if connect_timeout:
#             self.connect_timeout = connect_timeout
#         if socket_timeout:
#             self.socket_timeout = socket_timeout
#         if max_connections:
#             self.max_connections = max_connections
#         if proxy_configuration:
#             self.proxy_configuration = proxy_configuration
#         if integrator:
#             self.integrator = integrator
#         if shopping_cart_extension:
#             self.shopping_cart_extension = shopping_cart_extension
# 
#     @property
#     def api_endpoint(self):
#         """
#         The Ingenico ePayments platform API endpoint URI.
#         """
#         return super(CommunicatorConfiguration, self)._endpoint
# 
#     @api_endpoint.setter
#     def api_endpoint(self, api_endpoint):
#         super(CommunicatorConfiguration, self)._set_endpoint(api_endpoint)
# 
#     @property
#     def api_key_id(self):
#         """
#         An identifier for the secret API key. The api_key_id can be
#         retrieved from the Configuration Center. This identifier is visible in
#         the HTTP request and is also used to identify the correct account.
#         """
#         return self.__api_key_id
# 
#     @api_key_id.setter
#     def api_key_id(self, api_key_id):
#         self.__api_key_id = api_key_id
# 
#     @property
#     def secret_api_key(self):
#         """
#         A shared secret. The shared secret can be retrieved from the
#         Configuration Center. An api_key_id and secret_api_key always go
#         hand-in-hand, the difference is that secret_api_key is never visible in
#         the HTTP request. This secret is used as input for the HMAC algorithm.
#         """
#         return self.__secret_api_key
# 
#     @secret_api_key.setter
#     def secret_api_key(self, secret_api_key):
#         self.__secret_api_key = secret_api_key
# 
#     @property
#     def authorization_type(self):
#         return self.__authorization_type
# 
#     @authorization_type.setter
#     def authorization_type(self, authorization_type):
#         self.__authorization_type = authorization_type


import configparser
import unittest
from ingenico.connect.sdk.communicator_configuration import CommunicatorConfiguration
from ingenico.connect.sdk.defaultimpl.authorization_type import AuthorizationType
        self.assertIsNone(communicator_config.secret_api_key)
        self.assertIsNone(communicator_config.proxy_configuration)
        self.assertIsNone(communicator_config.integrator)
        self.assertIsNone(communicator_config.shopping_cart_extension)

    def test_construct_from_properties_with_proxy_without_authentication(self):
        """Tests if a CommunicatorConfiguration can be constructed correctly from settings including a proxy"""
        self.config.set('ConnectSDK', "connect.api.proxy.uri", "http://proxy.example.org:3128")

        communicator_config = CommunicatorConfiguration(self.config)

        self.assertDefaults(communicator_config)
        self.assertIsNone(communicator_config.api_key_id)
        self.assertIsNone(communicator_config.secret_api_key)
        proxy_config = communicator_config.proxy_configuration
        self.assertIsNotNone(proxy_config)
        self.assertEqual("http", proxy_config.scheme)
        self.assertEqual("proxy.example.org", proxy_config.host)
        self.assertEqual(3128, proxy_config.port)
        self.assertIsNone(proxy_config.username)
        self.assertIsNone(proxy_config.password)

    def test_construct_from_properties_with_proxy_authentication(self):
        """Tests if a CommunicatorConfiguration can be constructed correctly
        from settings with a proxy and authentication
        """
        self.config.set('ConnectSDK', "connect.api.proxy.uri", "http://proxy.example.org:3128")
        self.config.set('ConnectSDK', "connect.api.proxy.username", "connect-username")
        self.config.set('ConnectSDK', "connect.api.proxy.password", "connect-password")


# Path: ingenico/connect/sdk/communicator_configuration.py
# class CommunicatorConfiguration(EndpointConfiguration):
#     """
#     Configuration for the communicator.
# 
#     :param properties: a ConfigParser.ConfigParser object containing configuration data
#     :param connect_timeout: connection timeout for the network communication in seconds
#     :param socket_timeout: socket timeout for the network communication in seconds
#     :param max_connections: The maximum number of connections in the connection pool
#     """
#     __api_key_id = None
#     __secret_api_key = None
# 
#     def __init__(self, properties=None, api_endpoint=False, api_key_id=False,
#                  secret_api_key=False, authorization_type=False,
#                  connect_timeout=False, socket_timeout=False,
#                  max_connections=False, proxy_configuration=False,
#                  integrator=False, shopping_cart_extension=False):
#         if properties:
#             super(CommunicatorConfiguration, self).__init__(properties,
#                                                             "connect.api")
#             if properties.sections() and properties.options("ConnectSDK"):
#                 authorization = properties.get("ConnectSDK",
#                                                "connect.api.authorizationType")
#                 self.__authorization_type = AuthorizationType.get_authorization(
#                     authorization)
#         if api_endpoint:
#             self.api_endpoint = api_endpoint
#         if api_key_id:
#             self.api_key_id = api_key_id
#         if secret_api_key:
#             self.secret_api_key = secret_api_key
#         if authorization_type:
#             self.authorization_type = authorization_type
#         if connect_timeout:
#             self.connect_timeout = connect_timeout
#         if socket_timeout:
#             self.socket_timeout = socket_timeout
#         if max_connections:
#             self.max_connections = max_connections
#         if proxy_configuration:
#             self.proxy_configuration = proxy_configuration
#         if integrator:
#             self.integrator = integrator
#         if shopping_cart_extension:
#             self.shopping_cart_extension = shopping_cart_extension
# 
#     @property
#     def api_endpoint(self):
#         """
#         The Ingenico ePayments platform API endpoint URI.
#         """
#         return super(CommunicatorConfiguration, self)._endpoint
# 
#     @api_endpoint.setter
#     def api_endpoint(self, api_endpoint):
#         super(CommunicatorConfiguration, self)._set_endpoint(api_endpoint)
# 
#     @property
#     def api_key_id(self):
#         """
#         An identifier for the secret API key. The api_key_id can be
#         retrieved from the Configuration Center. This identifier is visible in
#         the HTTP request and is also used to identify the correct account.
#         """
#         return self.__api_key_id
# 
#     @api_key_id.setter
#     def api_key_id(self, api_key_id):
#         self.__api_key_id = api_key_id
# 
#     @property
#     def secret_api_key(self):
#         """
#         A shared secret. The shared secret can be retrieved from the
#         Configuration Center. An api_key_id and secret_api_key always go
#         hand-in-hand, the difference is that secret_api_key is never visible in
#         the HTTP request. This secret is used as input for the HMAC algorithm.
#         """
#         return self.__secret_api_key
# 
#     @secret_api_key.setter
#     def secret_api_key(self, secret_api_key):
#         self.__secret_api_key = secret_api_key
# 
#     @property
#     def authorization_type(self):
#         return self.__authorization_type
# 
#     @authorization_type.setter
#     def authorization_type(self, authorization_type):
#         self.__authorization_type = authorization_type


# Path: tests/unit/test_communicator_configuration.py
import configparser
import unittest
from ingenico.connect.sdk.communicator_configuration import CommunicatorConfiguration
from ingenico.connect.sdk.defaultimpl.authorization_type import AuthorizationType

        self.assertIsNone(communicator_config.secret_api_key)
        self.assertIsNone(communicator_config.proxy_configuration)
        self.assertIsNone(communicator_config.integrator)
        self.assertIsNone(communicator_config.shopping_cart_extension)

    def test_construct_from_properties_with_proxy_without_authentication(self):
        """Tests if a CommunicatorConfiguration can be constructed correctly from settings including a proxy"""
        self.config.set('ConnectSDK', "connect.api.proxy.uri", "http://proxy.example.org:3128")

        communicator_config = CommunicatorConfiguration(self.config)

        self.assertDefaults(communicator_config)
        self.assertIsNone(communicator_config.api_key_id)
        self.assertIsNone(communicator_config.secret_api_key)
        proxy_config = communicator_config.proxy_configuration
        self.assertIsNotNone(proxy_config)
        self.assertEqual("http", proxy_config.scheme)
        self.assertEqual("proxy.example.org", proxy_config.host)
        self.assertEqual(3128, proxy_config.port)
        self.assertIsNone(proxy_config.username)
        self.assertIsNone(proxy_config.password)

    def test_construct_from_properties_with_proxy_authentication(self):
        """Tests if a CommunicatorConfiguration can be constructed correctly
        from settings with a proxy and authentication
        """
        self.config.set('ConnectSDK', "connect.api.proxy.uri", "http://proxy.example.org:3128")
        self.config.set('ConnectSDK', "connect.api.proxy.username", "connect-username")
        self.config.set('ConnectSDK', "connect.api.proxy.password", "connect-password")


        communicator_config = CommunicatorConfiguration(self.config)