File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,14 +104,14 @@ def get_resources():
104104 resource_list = [
105105 resource .serialize for resource in paginated_resources .items
106106 ]
107- pagination_details = resource_paginator .pagination_details (paginated_resources )
107+ details = resource_paginator .details (paginated_resources )
108108 except Exception as e :
109109 logger .exception (e )
110110 return utils .standardize_response (status_code = 500 )
111111
112112 return utils .standardize_response (payload = dict (
113113 data = resource_list ,
114- ** pagination_details ),
114+ ** details ),
115115 datatype = "resources" )
116116
117117
Original file line number Diff line number Diff line change @@ -71,14 +71,14 @@ def search_results():
7171
7272 results = [utils .format_resource_search (result ) for result in search_result ['hits' ]]
7373
74- pagination_details = {
75- "pagination_details " : {
74+ details = {
75+ "details " : {
7676 "page" : search_result ['page' ],
7777 "number_of_pages" : search_result ['nbPages' ],
7878 "records_per_page" : search_result ['hitsPerPage' ],
7979 "total_count" : search_result ['nbHits' ],
8080 }
8181 }
8282 return utils .standardize_response (
83- payload = dict (data = results , ** pagination_details ),
83+ payload = dict (data = results , ** details ),
8484 datatype = "resources" )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def paginated_data(self, query):
4848 setattr (data , "per_page" , self .page_size )
4949 return data
5050
51- def pagination_details (self , paginated_data ):
51+ def details (self , paginated_data ):
5252 return {
5353 "details" : {
5454 "page" : paginated_data .page ,
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ def test_search(
2828 assert (result .status_code == 200 )
2929 assert (
3030 result .json ['resources' ][0 ]['url' ] == resource .json ['resources' ][0 ].get ('url' ))
31+ assert (isinstance (result .json ['page' ], int ))
32+ assert (isinstance (result .json ['number_of_pages' ], int ))
33+ assert (isinstance (result .json ['records_per_page' ], int ))
34+ assert (isinstance (result .json ['total_count' ], int ))
3135
3236 # Update the resource and test that search results reflect changes
3337 updated_term = random_string ()
@@ -41,6 +45,10 @@ def test_search(
4145 assert (resource .status_code == 200 )
4246 assert (result .status_code == 200 )
4347 assert (result .json ['resources' ][0 ]['url' ] == resource .json ['resource' ].get ('url' ))
48+ assert (isinstance (result .json ['page' ], int ))
49+ assert (isinstance (result .json ['number_of_pages' ], int ))
50+ assert (isinstance (result .json ['records_per_page' ], int ))
51+ assert (isinstance (result .json ['total_count' ], int ))
4452
4553
4654def test_search_paid_filter (module_client ,
You can’t perform that action at this time.
0 commit comments