Example #1
0
def test_createdb():
    url = 'postgresql://*****:*****@localhost:5432/createdb'
    db = SQLAlchemyORM(url)
    db.createdb(True)
    assert db.existsdb()
    db.dropdb()
    assert not db.existsdb()
Example #2
0
def test_createdb_dbexists():
    url = 'postgresql://*****:*****@localhost:5432/createdb'
    db = SQLAlchemyORM(url)
    db.createdb(True)
    with pytest.raises(Exception) as e:
        db.createdb(False)
    assert (('Database \'createdb\' already exists.') in str(e.value))
    db.dropdb()