From a97ea0ad6318b9c83e3ad4f93c456cb1e2d5cfa4 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Thu, 23 Jan 2020 14:58:35 +0100 Subject: [PATCH] adapt python tests --- python/src/deltachat/provider.py | 4 ++-- python/tests/test_lowlevel.py | 6 +++++- python/tests/test_provider_info.py | 8 -------- 3 files changed, 7 insertions(+), 11 deletions(-) delete mode 100644 python/tests/test_provider_info.py diff --git a/python/src/deltachat/provider.py b/python/src/deltachat/provider.py index 40591748a..487a84192 100644 --- a/python/src/deltachat/provider.py +++ b/python/src/deltachat/provider.py @@ -14,9 +14,9 @@ class Provider(object): :param domain: The email to get the provider info for. """ - def __init__(self, addr): + def __init__(self, account, addr): provider = ffi.gc( - lib.dc_provider_new_from_email(as_dc_charpointer(addr)), + lib.dc_provider_new_from_email(account._dc_context, as_dc_charpointer(addr)), lib.dc_provider_unref, ) if provider == ffi.NULL: diff --git a/python/tests/test_lowlevel.py b/python/tests/test_lowlevel.py index 41506bbaf..273414e99 100644 --- a/python/tests/test_lowlevel.py +++ b/python/tests/test_lowlevel.py @@ -103,7 +103,11 @@ def test_get_special_message_id_returns_empty_message(acfactory): def test_provider_info_none(): - assert lib.dc_provider_new_from_email(cutil.as_dc_charpointer("email@unexistent.no")) == ffi.NULL + ctx = ffi.gc( + lib.dc_context_new(lib.py_dc_callback, ffi.NULL, ffi.NULL), + lib.dc_context_unref, + ) + assert lib.dc_provider_new_from_email(ctx, cutil.as_dc_charpointer("email@unexistent.no")) == ffi.NULL def test_get_info_closed(): diff --git a/python/tests/test_provider_info.py b/python/tests/test_provider_info.py deleted file mode 100644 index af7f437ed..000000000 --- a/python/tests/test_provider_info.py +++ /dev/null @@ -1,8 +0,0 @@ -import pytest - -from deltachat import provider - - -def test_provider_info_none(): - with pytest.raises(provider.ProviderNotFoundError): - provider.Provider("email@unexistent.no")