Ejemplo n.º 1
0
def test_make_migrations_plugin(mocker, config, config_dir, entry_points):

    revision = mocker.patch("alembic.command.revision")

    # initialize a plugin
    cli.make_migrations(config_dir,
                        message="test revision",
                        plugin="quetz-plugin",
                        initialize=True)

    version_path = os.path.join(entry_points, "versions")
    revision.assert_called_with(
        mock.ANY,
        message="test revision",
        autogenerate=True,
        head="base",
        depends_on="quetz",
        version_path=version_path,
        branch_label="quetz-plugin",
        splice=True,
    )

    # add revision to a plugin
    cli.make_migrations(config_dir,
                        message="revision v2",
                        plugin="quetz-plugin",
                        initialize=False)
    revision.assert_called_with(
        mock.ANY,
        message="revision v2",
        autogenerate=True,
        head="quetz-plugin@head",
        version_path=version_path,
    )
Ejemplo n.º 2
0
def test_make_migrations_quetz(mocker, config, config_dir):
    revision = mocker.patch("alembic.command.revision")

    # new revision for main tree
    cli.make_migrations(
        config_dir, message="test revision", plugin="quetz", initialize=False
    )

    revision.assert_called_with(
        mock.ANY,
        message="test revision",
        autogenerate=True,
        head="quetz@head",
        version_path=None,
    )