Exemple #1
0
async def test_import_from_firstuse_delete_db_after(tmpcwd, app):
    with dbm.open('passwords.dbm', 'c', 0o600) as db:
        db['user1'] = 'password'

    auth = NaasAuthenticator(db=app.db)
    auth.delete_firstuse_db_after_import = True

    auth.add_data_from_firstuse()
    files = os.listdir()
    assert UserInfo.find(app.db, 'user1')
    assert ('passwords.dbm' not in files) and ('passwords.dbm.db' not in files)
Exemple #2
0
async def test_import_from_firstuse_delete_db_after(tmpcwd, app):
    with dbm.open("passwords.dbm", "c", 0o600) as db:
        db["user1"] = "password"

    auth = NaasAuthenticator(db=app.db)
    auth.delete_firstuse_db_after_import = True

    auth.add_data_from_firstuse()
    files = os.listdir()
    assert UserInfo.find(app.db, "user1")
    assert ("passwords.dbm" not in files) and ("passwords.dbm.db" not in files)