Exemplo n.º 1
0
def test_init_db():
    db.drop_all()
    db.create_all()

    inspector = db.inspect(db.engine)
    names = inspector.get_table_names()

    # If the database was created through Alembic migrations, the marker table
    # is never removed by SQLAlchemy.

    if 'alembic_version' in names:
        assert len(names) == 7
    else:
        assert len(names) == 6
Exemplo n.º 2
0
def database():
    db.drop_all()
    db.create_all()

    Document(slug='a', title='A', body='111').save()

    db.session.commit()

    Document.deactivate('a')

    db.session.commit()

    Document(slug='a', title='A', body='222').save()
    Document(slug='b', title='B', body='111').save()
    Document(slug='c', title='C', body='111').save()

    Metadata(slug='a', key='x', value='1').save()
    Metadata(slug='a', key='y', value='2').save()
    Metadata(slug='b', key='x', value='1').save()
    Metadata(slug='b', key='x', value='2').save()

    db.session.commit()
Exemplo n.º 3
0
def database():
    db.drop_all()
    db.create_all()
Exemplo n.º 4
0
def database():
    db.drop_all()
    db.create_all()

    load_fixtures()
Exemplo n.º 5
0
def client():
    db.drop_all()
    db.create_all()

    return app.test_client()