@@ -903,6 +903,36 @@ def test_invalid_limit_values(self, client, endpoint):
903903 "Input should be greater than 0" ,
904904 )
905905
906+ @pytest .mark .unit
907+ @pytest .mark .parametrize (
908+ "endpoint, odata" ,
909+ [
910+ (
911+ "/auxip/collections/s2_adgs2_AUX_OBMEMC/items?limit=10000000" ,
912+ "http://127.0.0.1:5001/Products?$filter=Attributes/OData.CSC.StringAttribute/any(att:att/Name eq "
913+ "'productType' and att/OData.CSC.StringAttribute/Value eq 'AUX_OBMEMC')&$orderby=PublicationDate "
914+ "desc&$top=9999&$skip=0&$expand=Attributes" ,
915+ ),
916+ (
917+ "/cadip/collections/cadip_session_by_id/items?limit=10000000" ,
918+ "http://127.0.0.1:5000/Sessions?$filter=SessionId eq 'S1A_20200105072204051312'&$orderby="
919+ "PublicationDate desc&$top=9999&$skip=0" ,
920+ ),
921+ ],
922+ )
923+ @responses .activate
924+ def test_bigger_limit_than_allowed (self , client , mock_token_validation , endpoint , odata ):
925+ """
926+ Test that if user request with a limit value bigger than max allowed in config
927+ the limit value is set to max_allowed - 1.
928+ Limit in request is set to 1_000_000, for given collection max allowed is set to 10000, therefore
929+ in the final odata request, $top is set to 9999.
930+ """
931+ mock_token_validation ()
932+ responses .add (responses .GET , odata , json = {"value" : []}, status = 200 )
933+ response = client .get (endpoint )
934+ assert response .status_code == status .HTTP_200_OK
935+
906936 @pytest .mark .unit
907937 @pytest .mark .parametrize (
908938 "endpoint" ,
0 commit comments