# Path: fixtest/base/config.py
# class FileConfig(Config):
#     """ Provide the configuration from a file.
#     """
# 
#     def __init__(self, file_name):
#         """ Initialize from the given fileName
# 
#             Args:
#                 file_name:
#         """
#         super(FileConfig, self).__init__()
#         execfile(file_name, globals(), self._config)
# 
# class DictConfig(Config):
#     """ Provide the configuration from a pre-existing dictionary.
#     """
#     def __init__(self, initial_config):
#         """ Dictionary-based configuration
# 
#             Args:
#                 initial_config
#         """
#         super(DictConfig, self).__init__()
#         self._config = initial_config


import os
import unittest
from fixtest.base.config import FileConfig, DictConfig
        self.assertEquals(19001, role_config['admin-port'])

        self.assertRaises(KeyError, self.config.get_role, 'serverYYY')

    def test_get_link(self):
        link_config = self.config.get_link('clientX', 'serverY')
        self.assertIsNotNone(link_config)
        self.assertEquals('client-fix-server', link_config['name'])

        self.assertRaises(KeyError, self.config.get_link,
                          'clientX', 'server')
        self.assertRaises(KeyError, self.config.get_link,
                          'clientX', 'serverY', 'fix')
        self.assertRaises(KeyError, self.config.get_link,
                          'client', 'serverY')

    def test_get_section(self):
        other_config = self.config.get_section('OTHER')
        self.assertIsNotNone(other_config)
        self.assertEquals('hello', other_config['test-id'])

        self.assertRaises(KeyError, self.config.get_section,
                          'OTHERXX')


class TestFileConfig(unittest.TestCase):
    # pylint: disable=missing-docstring
    def test_fileconfig(self):
        file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                 'test_config.txt')

# Path: fixtest/base/config.py
# class FileConfig(Config):
#     """ Provide the configuration from a file.
#     """
# 
#     def __init__(self, file_name):
#         """ Initialize from the given fileName
# 
#             Args:
#                 file_name:
#         """
#         super(FileConfig, self).__init__()
#         execfile(file_name, globals(), self._config)
# 
# class DictConfig(Config):
#     """ Provide the configuration from a pre-existing dictionary.
#     """
#     def __init__(self, initial_config):
#         """ Dictionary-based configuration
# 
#             Args:
#                 initial_config
#         """
#         super(DictConfig, self).__init__()
#         self._config = initial_config


# Path: fixtest/tests/base_config_test.py
import os
import unittest
from fixtest.base.config import FileConfig, DictConfig

        self.assertEquals(19001, role_config['admin-port'])

        self.assertRaises(KeyError, self.config.get_role, 'serverYYY')

    def test_get_link(self):
        link_config = self.config.get_link('clientX', 'serverY')
        self.assertIsNotNone(link_config)
        self.assertEquals('client-fix-server', link_config['name'])

        self.assertRaises(KeyError, self.config.get_link,
                          'clientX', 'server')
        self.assertRaises(KeyError, self.config.get_link,
                          'clientX', 'serverY', 'fix')
        self.assertRaises(KeyError, self.config.get_link,
                          'client', 'serverY')

    def test_get_section(self):
        other_config = self.config.get_section('OTHER')
        self.assertIsNotNone(other_config)
        self.assertEquals('hello', other_config['test-id'])

        self.assertRaises(KeyError, self.config.get_section,
                          'OTHERXX')


class TestFileConfig(unittest.TestCase):
    # pylint: disable=missing-docstring
    def test_fileconfig(self):
        file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                 'test_config.txt')

        config = FileConfig(file_path)