# Path: monolithe/config.py
# class MonolitheConfig(object):
# 
#     def __init__(self, path=None):
#         self.path = path
#         self.config = None
#         self.mapping = None
#         self.language = 'python'
# 
#         if self.path:
#             if not os.path.exists(path):
#                 raise Exception("Could not find path %s" % path)
#             config = ConfigParser()
#             config.read(path)
#             self.set_config(config)
# 
#     def copy(self):
#         # duplicate the config parser
#         conf_data = io.StringIO()
#         self.config.write(conf_data)
#         conf_data.seek(0)
#         new_config_parser = ConfigParser()
#         new_config_parser.readfp(conf_data)
# 
#         # create a new MonolitheConfig and give it the duplicate config parser
#         monolithe_config_copy = MonolitheConfig(path=self.path)
#         monolithe_config_copy.set_config(new_config_parser)
# 
#         return monolithe_config_copy
# 
#     def set_config(self, config):
#         self.config = config
# 
#         # vanilla
#         self.user_vanilla = self.get_option("user_vanilla", "transformer")
# 
#         # mapping
#         if not self.path:
#             return
# 
#         mapping_path = "%s/mapping.ini" % os.path.dirname(self.path)
# 
#         if not os.path.exists(self.path):
#             return
# 
#         self.mapping = ConfigParser()
#         self.mapping.read(mapping_path)
# 
#     def get_option(self, option, section="monolithe", **kwargs):
#         return self.config.get(section, option, **kwargs)
# 
#     def set_option(self, option, value, section="monolithe"):
#         return self.config.set(section, option, value)
# 
#     def map_attribute(self, rest_name, attribute_name):
#         if self.mapping is None \
#                 or not self.mapping.has_section(rest_name) \
#                 or not self.mapping.has_option(rest_name, attribute_name):
#             return attribute_name
# 
#         return self.mapping.get(rest_name, attribute_name)


import json
from unittest import TestCase
from monolithe.specifications import Specification
from monolithe.config import MonolitheConfig
        self.assertEquals(s.attributes[0].unique, True)
        self.assertEquals(s.attributes[0].unique_scope, 'global')
        self.assertEquals(s.attributes[0].subtype, None)

        self.assertEquals(len(s.child_apis), 2)
        self.assertEquals(s.child_apis[0].rest_name, 'toto')
        self.assertEquals(s.child_apis[0].relationship, 'child')
        self.assertEquals(s.child_apis[0].allows_create, True)
        self.assertEquals(s.child_apis[0].allows_update, False)
        self.assertEquals(s.child_apis[0].allows_delete, False)
        self.assertEquals(s.child_apis[0].allows_get, True)
        self.assertEquals(s.child_apis[0].allows_bulk_create, True)
        self.assertEquals(s.child_apis[0].allows_bulk_update, True)
        self.assertEquals(s.child_apis[0].allows_bulk_delete, True)

        self.assertEquals(s.child_apis[1].rest_name, 'user')
        self.assertEquals(s.child_apis[1].relationship, 'member')
        self.assertEquals(s.child_apis[1].allows_create, False)
        self.assertEquals(s.child_apis[1].allows_update, True)
        self.assertEquals(s.child_apis[1].allows_delete, False)
        self.assertEquals(s.child_apis[1].allows_get, True)
        self.assertEquals(s.child_apis[1].allows_bulk_create, False)
        self.assertEquals(s.child_apis[1].allows_bulk_update, False)
        self.assertEquals(s.child_apis[1].allows_bulk_delete, False)

    def test_specification_from_dict(self):
        """ Convert REST names to Python

        """
        data = json.loads(SPEC)

# Path: monolithe/config.py
# class MonolitheConfig(object):
# 
#     def __init__(self, path=None):
#         self.path = path
#         self.config = None
#         self.mapping = None
#         self.language = 'python'
# 
#         if self.path:
#             if not os.path.exists(path):
#                 raise Exception("Could not find path %s" % path)
#             config = ConfigParser()
#             config.read(path)
#             self.set_config(config)
# 
#     def copy(self):
#         # duplicate the config parser
#         conf_data = io.StringIO()
#         self.config.write(conf_data)
#         conf_data.seek(0)
#         new_config_parser = ConfigParser()
#         new_config_parser.readfp(conf_data)
# 
#         # create a new MonolitheConfig and give it the duplicate config parser
#         monolithe_config_copy = MonolitheConfig(path=self.path)
#         monolithe_config_copy.set_config(new_config_parser)
# 
#         return monolithe_config_copy
# 
#     def set_config(self, config):
#         self.config = config
# 
#         # vanilla
#         self.user_vanilla = self.get_option("user_vanilla", "transformer")
# 
#         # mapping
#         if not self.path:
#             return
# 
#         mapping_path = "%s/mapping.ini" % os.path.dirname(self.path)
# 
#         if not os.path.exists(self.path):
#             return
# 
#         self.mapping = ConfigParser()
#         self.mapping.read(mapping_path)
# 
#     def get_option(self, option, section="monolithe", **kwargs):
#         return self.config.get(section, option, **kwargs)
# 
#     def set_option(self, option, value, section="monolithe"):
#         return self.config.set(section, option, value)
# 
#     def map_attribute(self, rest_name, attribute_name):
#         if self.mapping is None \
#                 or not self.mapping.has_section(rest_name) \
#                 or not self.mapping.has_option(rest_name, attribute_name):
#             return attribute_name
# 
#         return self.mapping.get(rest_name, attribute_name)


# Path: tests/unit/test_specification.py
import json
from unittest import TestCase
from monolithe.specifications import Specification
from monolithe.config import MonolitheConfig

        self.assertEquals(s.attributes[0].unique, True)
        self.assertEquals(s.attributes[0].unique_scope, 'global')
        self.assertEquals(s.attributes[0].subtype, None)

        self.assertEquals(len(s.child_apis), 2)
        self.assertEquals(s.child_apis[0].rest_name, 'toto')
        self.assertEquals(s.child_apis[0].relationship, 'child')
        self.assertEquals(s.child_apis[0].allows_create, True)
        self.assertEquals(s.child_apis[0].allows_update, False)
        self.assertEquals(s.child_apis[0].allows_delete, False)
        self.assertEquals(s.child_apis[0].allows_get, True)
        self.assertEquals(s.child_apis[0].allows_bulk_create, True)
        self.assertEquals(s.child_apis[0].allows_bulk_update, True)
        self.assertEquals(s.child_apis[0].allows_bulk_delete, True)

        self.assertEquals(s.child_apis[1].rest_name, 'user')
        self.assertEquals(s.child_apis[1].relationship, 'member')
        self.assertEquals(s.child_apis[1].allows_create, False)
        self.assertEquals(s.child_apis[1].allows_update, True)
        self.assertEquals(s.child_apis[1].allows_delete, False)
        self.assertEquals(s.child_apis[1].allows_get, True)
        self.assertEquals(s.child_apis[1].allows_bulk_create, False)
        self.assertEquals(s.child_apis[1].allows_bulk_update, False)
        self.assertEquals(s.child_apis[1].allows_bulk_delete, False)

    def test_specification_from_dict(self):
        """ Convert REST names to Python

        """
        data = json.loads(SPEC)

        monolithe_config = MonolitheConfig()