Ejemplo n.º 1
0
def handle_moban_file(moban_file, options):
    """
    act upon default moban file
    """
    moban_file_configurations = plugins.load_data(None, moban_file)
    if moban_file_configurations is None:
        raise exceptions.MobanfileGrammarException(
            constants.ERROR_INVALID_MOBAN_FILE % moban_file)
    if (constants.LABEL_TARGETS not in moban_file_configurations
            and constants.LABEL_COPY not in moban_file_configurations):
        raise exceptions.MobanfileGrammarException(constants.ERROR_NO_TARGETS %
                                                   moban_file)
    check_none(moban_file_configurations, moban_file)
    version = moban_file_configurations.get(constants.MOBAN_VERSION,
                                            constants.DEFAULT_MOBAN_VERSION)
    if version == constants.DEFAULT_MOBAN_VERSION:
        mobanfile.handle_moban_file_v1(moban_file_configurations, options)
    else:
        raise exceptions.MobanfileGrammarException(
            constants.MESSAGE_FILE_VERSION_NOT_SUPPORTED % version)
    HASH_STORE.save_hashes()
Ejemplo n.º 2
0
def test_exception_2():
    test_file = os.path.join("tests", "fixtures", "dragon.yaml")
    load_data(os.path.join("tests", "fixtures", "config"), test_file)
Ejemplo n.º 3
0
def test_exception_3():
    test_file = os.path.join("tests", "fixtures", "dragon.yaml")
    load_data(None, test_file)
Ejemplo n.º 4
0
def test_inheritance_yaml():
    test_file = os.path.join("tests", "fixtures", "child.yaml")
    data = load_data(os.path.join("tests", "fixtures", "config"), test_file)
    eq_(data, {"key": "hello world", "pass": "******"})