mirror of
https://github.com/chatmail/relay.git
synced 2026-05-20 12:58:04 +00:00
fix nocreate tests
This commit is contained in:
@@ -14,10 +14,8 @@ def db(tmpdir):
|
|||||||
return Database(db_path)
|
return Database(db_path)
|
||||||
|
|
||||||
|
|
||||||
def test_basic(db):
|
def test_basic(db, tmpdir, monkeypatch):
|
||||||
chatmaild.dictproxy.NOCREATE_FILE = "/tmp/nocreate"
|
monkeypatch.setattr(chatmaild.dictproxy, "NOCREATE_FILE", tmpdir.join("nocreate").strpath)
|
||||||
if os.path.exists(chatmaild.dictproxy.NOCREATE_FILE):
|
|
||||||
os.remove(chatmaild.dictproxy.NOCREATE_FILE)
|
|
||||||
lookup_passdb(db, "link2xt@c1.testrun.org", "asdf")
|
lookup_passdb(db, "link2xt@c1.testrun.org", "asdf")
|
||||||
data = get_user_data(db, "link2xt@c1.testrun.org")
|
data = get_user_data(db, "link2xt@c1.testrun.org")
|
||||||
assert data
|
assert data
|
||||||
@@ -32,14 +30,12 @@ def test_dont_overwrite_password_on_wrong_login(db):
|
|||||||
assert res["password"] == res2["password"]
|
assert res["password"] == res2["password"]
|
||||||
|
|
||||||
|
|
||||||
def test_nocreate_file(db):
|
def test_nocreate_file(db, tmpdir, monkeypatch):
|
||||||
chatmaild.dictproxy.NOCREATE_FILE = "/tmp/nocreate"
|
nocreate = tmpdir.join("nocreate")
|
||||||
with open(chatmaild.dictproxy.NOCREATE_FILE, "w+") as f:
|
monkeypatch.setattr(chatmaild.dictproxy, "NOCREATE_FILE", str(nocreate))
|
||||||
f.write("")
|
nocreate.write("")
|
||||||
assert os.path.exists(chatmaild.dictproxy.NOCREATE_FILE)
|
|
||||||
lookup_passdb(db, "newuser1@something.org", "kajdlqweqwe")
|
lookup_passdb(db, "newuser1@something.org", "kajdlqweqwe")
|
||||||
assert not get_user_data(db, "newuser1@something.org")
|
assert not get_user_data(db, "newuser1@something.org")
|
||||||
os.remove(chatmaild.dictproxy.NOCREATE_FILE)
|
|
||||||
|
|
||||||
|
|
||||||
def test_db_version(db):
|
def test_db_version(db):
|
||||||
|
|||||||
Reference in New Issue
Block a user