@@ -365,62 +365,16 @@ def test_params_include_none(self):
365365class TestContentsGet :
366366 @responses .activate
367367 def test (self ):
368+ # All calls to get() should automatically include all available optional fields
368369 responses .get (
369370 "https://connect.example/__api__/v1/content/f2f37341-e21d-3d80-c698-a935ad614066" ,
370371 json = load_mock ("v1/content/f2f37341-e21d-3d80-c698-a935ad614066.json" ),
372+ match = [matchers .query_param_matcher ({"include" : "owner,tags,vanity_url" })],
371373 )
372374 con = Client ("https://connect.example" , "12345" )
373375 get_one = con .content .get ("f2f37341-e21d-3d80-c698-a935ad614066" )
374376 assert get_one ["name" ] == "Performance-Data-1671216053560"
375377
376- @responses .activate
377- def test_params_include_string (self ):
378- guid = "f2f37341-e21d-3d80-c698-a935ad614066"
379- mock_get = responses .get (
380- f"https://connect.example/__api__/v1/content/{ guid } " ,
381- json = load_mock (f"v1/content/{ guid } .json" ),
382- match = [matchers .query_param_matcher ({"include" : "owner" })],
383- )
384-
385- con = Client ("https://connect.example" , "12345" )
386- content = con .content .get (guid , include = "owner" )
387- assert content ["guid" ] == guid
388-
389- # assert
390- assert mock_get .call_count == 1
391-
392- @responses .activate
393- def test_params_include_list (self ):
394- guid = "f2f37341-e21d-3d80-c698-a935ad614066"
395- mock_get = responses .get (
396- f"https://connect.example/__api__/v1/content/{ guid } " ,
397- json = load_mock (f"v1/content/{ guid } .json" ),
398- match = [matchers .query_param_matcher ({"include" : "owner,tags,vanity_url" })],
399- )
400-
401- con = Client ("https://connect.example" , "12345" )
402- content = con .content .get (guid , include = ["owner" , "tags" , "vanity_url" ])
403- assert content ["guid" ] == guid
404-
405- # assert
406- assert mock_get .call_count == 1
407-
408- @responses .activate
409- def test_params_include_none (self ):
410- guid = "f2f37341-e21d-3d80-c698-a935ad614066"
411- mock_get = responses .get (
412- f"https://connect.example/__api__/v1/content/{ guid } " ,
413- json = load_mock (f"v1/content/{ guid } .json" ),
414- match = [matchers .query_param_matcher ({})],
415- )
416-
417- con = Client ("https://connect.example" , "12345" )
418- content = con .content .get (guid , include = None )
419- assert content ["guid" ] == guid
420-
421- # assert
422- assert mock_get .call_count == 1
423-
424378
425379class TestContentsCount :
426380 @responses .activate
0 commit comments