5
5
import sys
6
6
import unittest
7
7
import unittest .mock as mock
8
+ from itertools import chain
8
9
9
10
try :
10
11
from unittest .mock import AsyncMock
@@ -971,6 +972,14 @@ def test_package_list_available(self):
971
972
"ssl_verify" : False ,
972
973
}
973
974
975
+ if has_mamba :
976
+ # Change dummy to match mamba repoquery format
977
+ dummy = {
978
+ "result" : {
979
+ "pkgs" : list (chain (* dummy .values ()))
980
+ }
981
+ }
982
+
974
983
rvalue = [
975
984
(0 , json .dumps (dummy )),
976
985
(0 , json .dumps (channels )),
@@ -984,6 +993,13 @@ def test_package_list_available(self):
984
993
985
994
r = self .wait_for_task (self .conda_api .get , ["packages" ])
986
995
self .assertEqual (r .status_code , 200 )
996
+
997
+ args , _ = f .call_args_list [0 ]
998
+ if has_mamba :
999
+ self .assertSequenceEqual (args [1 :], ["repoquery" , "search" , "*" , "--json" ])
1000
+ else :
1001
+ self .assertSequenceEqual (args [1 :], ["search" , "--json" ])
1002
+
987
1003
body = r .json ()
988
1004
989
1005
expected = {
@@ -1164,6 +1180,14 @@ def test_package_list_available_local_channel(self):
1164
1180
],
1165
1181
}
1166
1182
1183
+ if has_mamba :
1184
+ # Change dummy to match mamba repoquery format
1185
+ dummy = {
1186
+ "result" : {
1187
+ "pkgs" : list (chain (* dummy .values ()))
1188
+ }
1189
+ }
1190
+
1167
1191
with tempfile .TemporaryDirectory () as local_channel :
1168
1192
with open (
1169
1193
os .path .join (local_channel , "channeldata.json" ), "w+"
@@ -1202,6 +1226,13 @@ def test_package_list_available_local_channel(self):
1202
1226
1203
1227
r = self .wait_for_task (self .conda_api .get , ["packages" ])
1204
1228
self .assertEqual (r .status_code , 200 )
1229
+
1230
+ args , _ = f .call_args_list [0 ]
1231
+ if has_mamba :
1232
+ self .assertSequenceEqual (args [1 :], ["repoquery" , "search" , "*" , "--json" ])
1233
+ else :
1234
+ self .assertSequenceEqual (args [1 :], ["search" , "--json" ])
1235
+
1205
1236
body = r .json ()
1206
1237
1207
1238
expected = {
@@ -1382,6 +1413,14 @@ def test_package_list_available_no_description(self):
1382
1413
],
1383
1414
}
1384
1415
1416
+ if has_mamba :
1417
+ # Change dummy to match mamba repoquery format
1418
+ dummy = {
1419
+ "result" : {
1420
+ "pkgs" : list (chain (* dummy .values ()))
1421
+ }
1422
+ }
1423
+
1385
1424
with tempfile .TemporaryDirectory () as local_channel :
1386
1425
local_name = local_channel .strip ("/" )
1387
1426
channels = {
@@ -1414,6 +1453,13 @@ def test_package_list_available_no_description(self):
1414
1453
1415
1454
r = self .wait_for_task (self .conda_api .get , ["packages" ])
1416
1455
self .assertEqual (r .status_code , 200 )
1456
+
1457
+ args , _ = f .call_args_list [0 ]
1458
+ if has_mamba :
1459
+ self .assertSequenceEqual (args [1 :], ["repoquery" , "search" , "*" , "--json" ])
1460
+ else :
1461
+ self .assertSequenceEqual (args [1 :], ["search" , "--json" ])
1462
+
1417
1463
body = r .json ()
1418
1464
1419
1465
expected = {
@@ -1620,6 +1666,15 @@ def test_package_list_available_caching(self):
1620
1666
"ssl_verify" : False ,
1621
1667
}
1622
1668
1669
+
1670
+ if has_mamba :
1671
+ # Change dummy to match mamba repoquery format
1672
+ dummy = {
1673
+ "result" : {
1674
+ "pkgs" : list (chain (* dummy .values ()))
1675
+ }
1676
+ }
1677
+
1623
1678
rvalue = [
1624
1679
(0 , json .dumps (dummy )),
1625
1680
(0 , json .dumps (channels )),
@@ -1635,6 +1690,12 @@ def test_package_list_available_caching(self):
1635
1690
r = self .wait_for_task (self .conda_api .get , ["packages" ])
1636
1691
self .assertEqual (r .status_code , 200 )
1637
1692
1693
+ args , _ = f .call_args_list [0 ]
1694
+ if has_mamba :
1695
+ self .assertSequenceEqual (args [1 :], ["repoquery" , "search" , "*" , "--json" ])
1696
+ else :
1697
+ self .assertSequenceEqual (args [1 :], ["search" , "--json" ])
1698
+
1638
1699
expected = {
1639
1700
"packages" : [
1640
1701
{
0 commit comments