@@ -8,20 +8,39 @@ async def test_concurrent_requests(b24):
88 with aioresponses () as m :
99 m .get (
1010 "https://example.bitrix24.com/rest/1/123456789/crm.deal.list.json?start=0" ,
11- payload = {"result" : [{"ID" : 1 }], "next" : 50 , "total" : 100 },
11+ payload = {"result" : [{"ID" : 1 }], "next" : 50 , "total" : 82 },
1212 status = 200 ,
1313 repeat = True ,
1414 )
1515 m .get (
1616 "https://example.bitrix24.com/rest/1/123456789/crm.deal.list.json?start=50" ,
17- payload = {"result" : [{"ID" : 2 }], "total" : 100 },
17+ payload = {"result" : [{"ID" : 2 }], "total" : 82 },
1818 status = 200 ,
1919 repeat = True ,
2020 )
2121 res = await b24 .callMethod ("crm.deal.list" )
2222 assert res == [{"ID" : 1 }, {"ID" : 2 }]
2323
2424
25+ @pytest .mark .asyncio
26+ async def test_concurrent_requests_nesting_level (b24 ):
27+ with aioresponses () as m :
28+ m .get (
29+ "https://example.bitrix24.com/rest/1/123456789/tasks.task.list.json?start=0" ,
30+ payload = {"result" : {"tasks" : [{"ID" : 1 }]}, "next" : 50 , "total" : 100 },
31+ status = 200 ,
32+ repeat = True ,
33+ )
34+ m .get (
35+ "https://example.bitrix24.com/rest/1/123456789/tasks.task.list.json?start=50" ,
36+ payload = {"result" : {"tasks" : [{"ID" : 2 }]}, "total" : 100 },
37+ status = 200 ,
38+ repeat = True ,
39+ )
40+ res = await b24 .callMethod ("tasks.task.list" )
41+ assert res == {"tasks" : [{"ID" : 1 }, {"ID" : 2 }]}
42+
43+
2544@pytest .mark .asyncio
2645async def test_request_with_disabled_pagination ():
2746 b24 = Bitrix24 ("https://example.bitrix24.com/rest/1/123456789" , fetch_all_pages = False )
0 commit comments