Files
chatmail-core/python/tests/test_lowlevel.py
holger krekel 6ce8374513 feat: bring back and adapt python bindings with rust core
* import python, try to adapt for rust

* add missing wrapper functions

* - try to write up how to build python bindings
- strike some unused functions from deltachat.h

* adjustments to make tox work

* try to run circle-ci with python build

* don't do docs

* running cargo test as well

* don't run cargo test anymore, that's done in other ci jobs

* also build docs

* don't run doxygen anymore

* subst C with Rust

* a try to get better wheels

Closes #41
2019-05-30 23:17:38 +02:00

30 lines
826 B
Python

from __future__ import print_function
import pytest
from deltachat import capi, Account, const
def test_empty_context():
ctx = capi.lib.dc_context_new(capi.ffi.NULL, capi.ffi.NULL, capi.ffi.NULL)
capi.lib.dc_close(ctx)
def test_wrong_db(tmpdir):
tmpdir.join("hello.db").write("123")
with pytest.raises(ValueError):
Account(db_path=tmpdir.strpath)
def test_event_defines():
assert const.DC_EVENT_INFO == 100
assert const.DC_CONTACT_ID_SELF
def test_sig():
sig = capi.lib.dc_get_event_signature_types
assert sig(const.DC_EVENT_INFO) == 2
assert sig(const.DC_EVENT_WARNING) == 2
assert sig(const.DC_EVENT_ERROR) == 2
assert sig(const.DC_EVENT_SMTP_CONNECTED) == 2
assert sig(const.DC_EVENT_IMAP_CONNECTED) == 2
assert sig(const.DC_EVENT_SMTP_MESSAGE_SENT) == 2