Ejemplo n.º 1
0
def test_find_invalid_migration_name(path):
    with CliRunner().isolated_filesystem():
        path.return_value.parent.__truediv__.return_value.glob = Mock(
            return_value=[
                Path.cwd() / '0001.sql',
                Path.cwd() / '0002.sql',
                Path.cwd() / 'abcd.sql',
            ])
        with pytest.raises(click.Abort):
            _find_migrations()
Ejemplo n.º 2
0
def test_find_migrations(path):
    with CliRunner().isolated_filesystem():
        path.return_value.parent.__truediv__.return_value.glob = Mock(
            return_value=[
                Path.cwd() / '0001.sql',
                Path.cwd() / '0002.sql',
                Path.cwd() / '0003.sql',
            ])
        assert len(_find_migrations()) == 3