33from mpt_api_client .http import AsyncHTTPClient , HTTPClient
44from mpt_api_client .mpt_client import AsyncMPTClient , MPTClient
55from mpt_api_client .resources import (
6+ Accounts ,
7+ AsyncAccounts ,
68 AsyncAudit ,
79 AsyncBilling ,
810 AsyncCatalog ,
1517from tests .conftest import API_TOKEN , API_URL
1618
1719
18- def test_mpt_client () -> None :
19- mpt = MPTClient .from_config (base_url = API_URL , api_token = API_TOKEN )
20- commerce = mpt .commerce
21- catalog = mpt .catalog
22- audit = mpt .audit
23- billing = mpt .billing
20+ def get_mpt_client ():
21+ return MPTClient .from_config (base_url = API_URL , api_token = API_TOKEN )
2422
25- assert isinstance (mpt , MPTClient )
26- assert isinstance (commerce , Commerce )
27- assert isinstance (catalog , Catalog )
28- assert isinstance (audit , Audit )
29- assert isinstance (billing , Billing )
23+
24+ def get_async_mpt_client ():
25+ return AsyncMPTClient .from_config (base_url = API_URL , api_token = API_TOKEN )
26+
27+
28+ @pytest .mark .parametrize (
29+ ("domain_module" , "domain_type" ),
30+ [
31+ (get_mpt_client (), MPTClient ),
32+ (get_mpt_client ().commerce , Commerce ),
33+ (get_mpt_client ().catalog , Catalog ),
34+ (get_mpt_client ().audit , Audit ),
35+ (get_mpt_client ().billing , Billing ),
36+ (get_mpt_client ().accounts , Accounts ),
37+ ],
38+ )
39+ def test_mpt_client (domain_module , domain_type ) -> None :
40+ assert isinstance (domain_module , domain_type )
3041
3142
3243def test_mpt_client_env (monkeypatch : pytest .MonkeyPatch ) -> None :
@@ -39,18 +50,19 @@ def test_mpt_client_env(monkeypatch: pytest.MonkeyPatch) -> None:
3950 assert isinstance (mpt .http_client , HTTPClient )
4051
4152
42- def test_async_mpt_client () -> None :
43- mpt = AsyncMPTClient .from_config (base_url = API_URL , api_token = API_TOKEN )
44- commerce = mpt .commerce
45- catalog = mpt .catalog
46- audit = mpt .audit
47- billing = mpt .billing
48-
49- assert isinstance (mpt , AsyncMPTClient )
50- assert isinstance (commerce , AsyncCommerce )
51- assert isinstance (catalog , AsyncCatalog )
52- assert isinstance (audit , AsyncAudit )
53- assert isinstance (billing , AsyncBilling )
53+ @pytest .mark .parametrize (
54+ ("domain_module" , "domain_type" ),
55+ [
56+ (get_async_mpt_client (), AsyncMPTClient ),
57+ (get_async_mpt_client ().commerce , AsyncCommerce ),
58+ (get_async_mpt_client ().catalog , AsyncCatalog ),
59+ (get_async_mpt_client ().audit , AsyncAudit ),
60+ (get_async_mpt_client ().billing , AsyncBilling ),
61+ (get_async_mpt_client ().accounts , AsyncAccounts ),
62+ ],
63+ )
64+ def test_async_mpt_client (domain_module , domain_type ) -> None :
65+ assert isinstance (domain_module , domain_type )
5466
5567
5668def test_async_mpt_client_env (monkeypatch : pytest .MonkeyPatch ) -> None :
0 commit comments