Exemplo n.º 1
0
def test_migration_schema_invalid_yaml(mocker, tmp_path):
    """Checks the error that is raised when the schema file is invalid yaml"""
    migration_docs_root = tmp_path / '.migration-docs'
    migration_docs_root.mkdir()

    migration_schema = migration_docs_root / 'migration.yaml'
    migration_schema.write_text('[invalid yaml')

    mocker.patch(
        'migration_docs.core._get_migration_docs_file_root',
        return_value=str(migration_docs_root),
        autospec=True,
    )

    with pytest.raises(RuntimeError, match='migration.yaml is corrupt'):
        core.MigrationDocs().schema
Exemplo n.º 2
0
def test_migration_docs_no_files():
    """
    Verify the MigrationDocs object loads no docs when the
    .migration-docs/docs.yaml file doesnt exist. Also verifies the
    default schema is present when .migration-docs/migration.yaml does
    not exist
    """
    docs = core.MigrationDocs()
    assert docs.data == {}
    assert docs.schema._raw_schema == [
        {
            'help': 'The point of contact for this migration.',
            'label': 'point_of_contact',
        },
        {
            'help': 'An in-depth description of the migration.',
            'label': 'description',
            'multiline': True,
        },
    ]