@@ -8,20 +8,39 @@ async def test_concurrent_requests(b24):
8
8
with aioresponses () as m :
9
9
m .get (
10
10
"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 },
12
12
status = 200 ,
13
13
repeat = True ,
14
14
)
15
15
m .get (
16
16
"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 },
18
18
status = 200 ,
19
19
repeat = True ,
20
20
)
21
21
res = await b24 .callMethod ("crm.deal.list" )
22
22
assert res == [{"ID" : 1 }, {"ID" : 2 }]
23
23
24
24
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
+
25
44
@pytest .mark .asyncio
26
45
async def test_request_with_disabled_pagination ():
27
46
b24 = Bitrix24 ("https://example.bitrix24.com/rest/1/123456789" , fetch_all_pages = False )
0 commit comments