@@ -1283,6 +1283,59 @@ def test_linear_client_validate_requires_viewer_email(self) -> None:
12831283 with self .assertRaisesRegex (RuntimeError , "viewer.email" ):
12841284 client .validate ()
12851285
1286+ def test_linear_client_list_users_paginates (self ) -> None :
1287+ http = RecordingHTTP (
1288+ [
1289+ {
1290+ "data" : {
1291+ "users" : {
1292+ "nodes" : [{"id" : "U1" , "name" : "Alice" }],
1293+ "pageInfo" : {
1294+ "hasNextPage" : True ,
1295+ "endCursor" : "cursor-1" ,
1296+ },
1297+ }
1298+ }
1299+ },
1300+ {
1301+ "data" : {
1302+ "users" : {
1303+ "nodes" : [{"id" : "U2" , "name" : "Bob" }],
1304+ "pageInfo" : {
1305+ "hasNextPage" : False ,
1306+ "endCursor" : None ,
1307+ },
1308+ }
1309+ }
1310+ },
1311+ ]
1312+ )
1313+
1314+ users = LinearClient ("token" , http = http ).list_users (page_size = 25 )
1315+
1316+ self .assertEqual ([user ["id" ] for user in users ], ["U1" , "U2" ])
1317+ first_body = json_dict (http .calls [0 ]["json_body" ])
1318+ second_body = json_dict (http .calls [1 ]["json_body" ])
1319+ self .assertEqual (
1320+ json_dict (first_body .get ("variables" )),
1321+ {"first" : 25 , "after" : None },
1322+ )
1323+ self .assertEqual (
1324+ json_dict (second_body .get ("variables" )),
1325+ {"first" : 25 , "after" : "cursor-1" },
1326+ )
1327+
1328+ def test_json_cache_helpers_round_trip_and_parse (self ) -> None :
1329+ with tempfile .TemporaryDirectory () as tmp :
1330+ path = Path (tmp ) / "nested" / "cache.json"
1331+
1332+ src .save_json_cache (path , {"b" : {"name" : "Bob" }, "a" : {"name" : "Alice" }})
1333+ parsed = src .load_json_cache (path , parse = lambda value : str (value .get ("name" , "" )))
1334+ subset = src .load_json_subset (path , ["a" , "missing" ], parse = lambda value : value )
1335+
1336+ self .assertEqual (parsed , {"a" : "Alice" , "b" : "Bob" })
1337+ self .assertEqual (subset , {"a" : {"name" : "Alice" }})
1338+
12861339 def test_resolve_op_secret_ref_leaves_raw_values_alone (self ) -> None :
12871340 self .assertEqual (resolve_op_secret_ref (" raw-secret " ), "raw-secret" )
12881341
0 commit comments