Repository: getmoto/moto

Issue:
ELB (and v1 and v2) describe_load_balancers should correctly support PageSize
If I call `response = elbv2_client.describe_load_balancers(PageSize=5)`, it raises

```
self = <moto.elbv2.responses.ELBV2Response object at 0x10c9284a8>

    @amzn_request_id
    def describe_load_balancers(self):
        arns = self._get_multi_param("LoadBalancerArns.member")
        names = self._get_multi_param("Names.member")
        all_load_balancers = list(self.elbv2_backend.describe_load_balancers(arns, names))
        marker = self._get_param('Marker')
        all_names = [balancer.name for balancer in all_load_balancers]
        if marker:
            start = all_names.index(marker) + 1
        else:
            start = 0
        page_size = self._get_param('PageSize', 50)  # the default is 400, but using 50 to make testing easier
>       load_balancers_resp = all_load_balancers[start:start + page_size]
E       TypeError: unsupported operand type(s) for +: 'int' and 'str'
```

When I call this method without specifying PageSize, it works correctly.

It looks like it should be using _get_int_param('PageSize', 50) instead of _get_param.  I'll submit a patch with this fix shortly.


Discussion:

Resolving patch:
diff --git a/moto/elb/responses.py b/moto/elb/responses.py
--- a/moto/elb/responses.py
+++ b/moto/elb/responses.py
@@ -61,7 +61,7 @@ def describe_load_balancers(self):
             start = all_names.index(marker) + 1
         else:
             start = 0
-        page_size = self._get_param('PageSize', 50)  # the default is 400, but using 50 to make testing easier
+        page_size = self._get_int_param('PageSize', 50)  # the default is 400, but using 50 to make testing easier
         load_balancers_resp = all_load_balancers[start:start + page_size]
         next_marker = None
         if len(all_load_balancers) > start + page_size:
diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py
--- a/moto/elbv2/responses.py
+++ b/moto/elbv2/responses.py
@@ -242,7 +242,7 @@ def describe_load_balancers(self):
             start = all_names.index(marker) + 1
         else:
             start = 0
-        page_size = self._get_param('PageSize', 50)  # the default is 400, but using 50 to make testing easier
+        page_size = self._get_int_param('PageSize', 50)  # the default is 400, but using 50 to make testing easier
         load_balancers_resp = all_load_balancers[start:start + page_size]
         next_marker = None
         if len(all_load_balancers) > start + page_size:
@@ -468,7 +468,7 @@ def describe_tags(self):
     def describe_account_limits(self):
         # Supports paging but not worth implementing yet
         # marker = self._get_param('Marker')
-        # page_size = self._get_param('PageSize')
+        # page_size = self._get_int_param('PageSize')
 
         limits = {
             'application-load-balancers': 20,
@@ -489,7 +489,7 @@ def describe_ssl_policies(self):
         names = self._get_multi_param('Names.member.')
         # Supports paging but not worth implementing yet
         # marker = self._get_param('Marker')
-        # page_size = self._get_param('PageSize')
+        # page_size = self._get_int_param('PageSize')
 
         policies = SSL_POLICIES
         if names:


Test patch: