Revert back to only ffi-level checking of open context

The Rust context is always open, the return value of this function was
simply the wrong way around.
This commit is contained in:
Floris Bruynooghe
2019-09-26 19:29:24 +02:00
committed by holger krekel
parent 8520b5211a
commit 8b7cd2dd1a
2 changed files with 23 additions and 3 deletions

View File

@@ -130,3 +130,21 @@ def test_get_info_open(tmpdir):
info = cutil.from_dc_charpointer(lib.dc_get_info(ctx))
assert 'deltachat_core_version' in info
assert 'database_dir' in info
def test_is_open_closed():
ctx = ffi.gc(
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
lib.dc_context_unref,
)
assert lib.dc_is_open(ctx) == 0
def test_is_open_actually_open(tmpdir):
ctx = ffi.gc(
lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL),
lib.dc_context_unref,
)
db_fname = tmpdir.join("test.db")
lib.dc_open(ctx, db_fname.strpath.encode("ascii"), ffi.NULL)
assert lib.dc_is_open(ctx) == 1