コード例 #1
0
def test_parse_yaml_example():
    file_example = StringIO(YAML_EXAMPLE)
    config = Config(None, 'test')
    constructor = YamlParser(config)
    constructor.load_from_buffer(file_example)
    migration = constructor.parse()
    assert len(migration.versions) == 4
コード例 #2
0
 def runner(filename, allow_serie=True, mode=None):
     migration_file = os.path.join(request.fspath.dirname, 'examples',
                                   filename)
     config = Config(migration_file,
                     'test',
                     allow_serie=allow_serie,
                     mode=mode)
     migration_constructor = YamlParser(config)
     migration_constructor.load_from_file(config.migration_file)
     migration = migration_constructor.parse()
     table = mock.MagicMock(spec=MigrationTable)
     table.versions.return_value = []
     database = mock.MagicMock(spec=Database)
     return Runner(config, migration, database, table)
コード例 #3
0
ファイル: test_backup.py プロジェクト: modoolar/marabunta
 def parser(filename, allow_serie=True, mode=None):
     migration_file = os.path.join(request.fspath.dirname,
                                   'examples', filename)
     config = Config(migration_file,
                     'test',
                     allow_serie=allow_serie,
                     mode=mode)
     migration_parser = YamlParser.parse_from_file(config.migration_file)
     return migration_parser, config
コード例 #4
0
ファイル: test_backup.py プロジェクト: camptocamp/marabunta
 def parser(filename, allow_serie=True, mode=None):
     migration_file = os.path.join(request.fspath.dirname,
                                   'examples', filename)
     config = Config(migration_file,
                     'test',
                     allow_serie=allow_serie,
                     mode=mode)
     migration_parser = YamlParser.parse_from_file(config.migration_file)
     return migration_parser, config
コード例 #5
0
 def runner(filename, allow_serie=True, mode=None, db_versions=None):
     migration_file = os.path.join(request.fspath.dirname,
                                   'examples', filename)
     config = Config(migration_file,
                     'test',
                     allow_serie=allow_serie,
                     mode=mode)
     migration_parser = YamlParser.parse_from_file(config.migration_file)
     migration = migration_parser.parse()
     table = mock.MagicMock(spec=MigrationTable)
     table.versions.return_value = db_versions or []
     database = mock.MagicMock(spec=Database)
     return Runner(config, migration, database, table)
コード例 #6
0
ファイル: test_parse.py プロジェクト: guewen/marabunta
 def test_parse_yaml_example(self):
     file_example = StringIO(YAML_EXAMPLE)
     parser = YamlParser.parser_from_buffer(file_example)
     migration = parser.parse()
     self.assertEqual(len(migration.versions), 4)
コード例 #7
0
ファイル: test_parse.py プロジェクト: x1g1/marabunta
def test_dublicate_key_exception():
    yaml_file = StringIO(YAML_WITH_EXCEPTION)
    with pytest.raises(DuplicateKeyError):
        parser = YamlParser.parser_from_buffer(yaml_file)
        parser.parse()
コード例 #8
0
ファイル: test_parse.py プロジェクト: x1g1/marabunta
def test_parse_yaml_example():
    file_example = StringIO(YAML_EXAMPLE)
    parser = YamlParser.parser_from_buffer(file_example)
    migration = parser.parse()
    assert len(migration.versions) == 4