File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 "accounts.account.id" : " ACC-9042-0088" ,
77 "accounts.buyer.account.id" : " ACC-1086-6867" ,
88 "accounts.buyer.id" : " BUY-1591-2112" ,
9- "accounts.user_group.id" : " UGR-6822-0561"
9+ "accounts.user_group.id" : " UGR-6822-0561" ,
10+ "accounts.module.id" : " MOD-1756" ,
11+ "accounts.module.name" : " Access Management"
1012}
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from mpt_api_client .exceptions import MPTAPIError
4+ from mpt_api_client .rql .query_builder import RQLQuery
5+
6+
7+ async def test_get_module_by_id (async_mpt_ops , module_id ):
8+ module = await async_mpt_ops .accounts .modules .get (module_id )
9+ assert module is not None
10+
11+
12+ async def test_list_modules (async_mpt_ops ):
13+ limit = 10
14+ modules = await async_mpt_ops .accounts .modules .fetch_page (limit = limit )
15+ assert len (modules ) > 0
16+
17+
18+ async def test_get_module_by_id_not_found (async_mpt_ops , invalid_module_id ):
19+ with pytest .raises (MPTAPIError , match = r"404 Not Found" ):
20+ await async_mpt_ops .accounts .modules .get (invalid_module_id )
21+
22+
23+ async def test_filter_modules (async_mpt_ops , module_id , module_name ):
24+ select_fields = ["-description" ]
25+
26+ filtered_modules = (
27+ async_mpt_ops .accounts .modules .filter (RQLQuery (id = module_id ))
28+ .filter (RQLQuery (name = module_name ))
29+ .select (* select_fields )
30+ )
31+
32+ modules = [filtered_module async for filtered_module in filtered_modules .iterate ()]
33+
34+ assert len (modules ) == 1
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from mpt_api_client .exceptions import MPTAPIError
4+ from mpt_api_client .rql .query_builder import RQLQuery
5+
6+
7+ def test_get_module_by_id (mpt_ops , module_id ):
8+ module = mpt_ops .accounts .modules .get (module_id )
9+ assert module is not None
10+
11+
12+ def test_list_modules (mpt_ops ):
13+ limit = 10
14+ modules = mpt_ops .accounts .modules .fetch_page (limit = limit )
15+ assert len (modules ) > 0
16+
17+
18+ def test_get_module_by_id_not_found (mpt_ops , invalid_module_id ):
19+ with pytest .raises (MPTAPIError , match = r"404 Not Found" ):
20+ mpt_ops .accounts .modules .get (invalid_module_id )
21+
22+
23+ def test_filter_modules (mpt_ops , module_id , module_name ):
24+ select_fields = ["-description" ]
25+
26+ filtered_modules = (
27+ mpt_ops .accounts .modules .filter (RQLQuery (id = module_id ))
28+ .filter (RQLQuery (name = module_name ))
29+ .select (* select_fields )
30+ )
31+
32+ modules = list (filtered_modules .iterate ())
33+
34+ assert len (modules ) == 1
Original file line number Diff line number Diff line change @@ -123,3 +123,18 @@ def user_group_id(e2e_config):
123123@pytest .fixture
124124def invalid_user_group_id ():
125125 return "UGR-0000-0000"
126+
127+
128+ @pytest .fixture
129+ def module_id (e2e_config ):
130+ return e2e_config ["accounts.module.id" ]
131+
132+
133+ @pytest .fixture
134+ def invalid_module_id ():
135+ return "MOD-0000"
136+
137+
138+ @pytest .fixture
139+ def module_name (e2e_config ):
140+ return e2e_config ["accounts.module.name" ]
You can’t perform that action at this time.
0 commit comments