tests: move database initialization to fixture
This commit is contained in:
parent
8217dc6f01
commit
6d590103ee
@ -4,15 +4,18 @@ import pytest
|
||||
from doveauth.doveauth import get_user_data, verify_user, Database
|
||||
|
||||
|
||||
def test_basic(tmpdir):
|
||||
db = Database(tmpdir / "passdb.sqlite")
|
||||
@pytest.fixture()
|
||||
def db(tmpdir):
|
||||
return Database(tmpdir / "passdb.sqlite")
|
||||
|
||||
|
||||
def test_basic(db):
|
||||
verify_user(db, "link2xt@c1.testrun.org", "asdf")
|
||||
data = get_user_data(db, "link2xt@c1.testrun.org")
|
||||
assert data
|
||||
|
||||
|
||||
def test_verify_or_create(tmpdir):
|
||||
db = Database(tmpdir / "passdb.sqlite")
|
||||
def test_verify_or_create(db):
|
||||
res = verify_user(db, "newuser1@something.org", "kajdlkajsldk12l3kj1983")
|
||||
assert res["status"] == "ok"
|
||||
res = verify_user(db, "newuser1@something.org", "kajdlqweqwe")
|
||||
|
Loading…
Reference in New Issue
Block a user