示例#1
0
def test_build_state_from_db(master_config, with_build, with_files,
                             build_state_hacked):
    db = Database(master_config.dsn)
    build_state_hacked.logged(with_build.build_id)
    for file_state in build_state_hacked.files.values():
        file_state.verified()
    assert BuildState.from_db(db, with_build.build_id) == build_state_hacked
示例#2
0
def db_intf(request, master_config, with_schema):
    intf = Database(master_config.dsn)

    def fin():
        intf._conn.close()

    request.addfinalizer(fin)
    return intf
示例#3
0
def test_init_wrong_version(master_config, db, with_schema):
    with db.begin():
        db.execute("UPDATE configuration SET version = '0.0'")
    with pytest.raises(RuntimeError):
        Database(master_config.dsn)
示例#4
0
def test_init(master_config, db, with_schema):
    try:
        intf = Database(master_config.dsn)
    finally:
        intf._conn.close()
示例#5
0
def test_build_state_from_db_unknown_build(master_config, with_build):
    db = Database(master_config.dsn)
    assert with_build.build_id != 1000
    with pytest.raises(ValueError):
        BuildState.from_db(db, 1000)