adapt python tests

This commit is contained in:
B. Petersen
2020-01-23 14:58:35 +01:00
parent da66a4d22f
commit a97ea0ad63
3 changed files with 7 additions and 11 deletions

View File

@@ -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:

View File

@@ -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():

View File

@@ -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")