Repository: auth0/auth0-python

Issue:
ClientGrants.all is missing `client_id` parameter supported by the API
https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants

Comments:

Patch:
diff --git a/auth0/v3/management/client_grants.py b/auth0/v3/management/client_grants.py
index 6b37015..719aab3 100644
--- a/auth0/v3/management/client_grants.py
+++ b/auth0/v3/management/client_grants.py
@@ -24,7 +24,7 @@ class ClientGrants(object):
             return url + '/' + id
         return url
 
-    def all(self, audience=None, page=None, per_page=None, include_totals=False):
+    def all(self, audience=None, page=None, per_page=None, include_totals=False, client_id=None):
         """Retrieves all client grants.
 
         Args:
@@ -37,7 +37,9 @@ class ClientGrants(object):
 
             include_totals (bool, optional): True if the query summary is
                 to be included in the result, False otherwise.
-            
+
+            client_id (string, optional): The id of a client to filter
+
         See: https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants
         """
 
@@ -45,7 +47,8 @@ class ClientGrants(object):
             'audience': audience,
             'page': page,
             'per_page': per_page,
-            'include_totals': str(include_totals).lower()
+            'include_totals': str(include_totals).lower(),
+            'client_id': client_id,
         }
 
         return self.client.get(self._url(), params=params)
diff --git a/auth0/v3/management/users_by_email.py b/auth0/v3/management/users_by_email.py
index 0c92e6a..24622a9 100644
--- a/auth0/v3/management/users_by_email.py
+++ b/auth0/v3/management/users_by_email.py
@@ -39,7 +39,7 @@ class UsersByEmail(object):
         See: https://auth0.com/docs/api/management/v2#!/Users_By_Email/get_users_by_email
         """
         params = {
-            'email': email.lower(),
+            'email': email,
             'fields': fields and ','.join(fields) or None,
             'include_fields': str(include_fields).lower()
         }


Test patch:
diff --git a/auth0/v3/test/management/test_client_grants.py b/auth0/v3/test/management/test_client_grants.py
index 3d6b292..1155649 100644
--- a/auth0/v3/test/management/test_client_grants.py
+++ b/auth0/v3/test/management/test_client_grants.py
@@ -21,7 +21,8 @@ class TestClientGrants(unittest.TestCase):
             'audience': None,
             'page': None,
             'per_page': None,
-            'include_totals': 'false'
+            'include_totals': 'false',
+            'client_id': None,
         })
 
         # With audience
@@ -34,7 +35,8 @@ class TestClientGrants(unittest.TestCase):
             'audience': 'http://domain.auth0.com/api/v2/',
             'page': None,
             'per_page': None,
-            'include_totals': 'false'
+            'include_totals': 'false',
+            'client_id': None,
         })
 
         # With pagination params
@@ -47,7 +49,22 @@ class TestClientGrants(unittest.TestCase):
             'audience': None,
             'page': 7,
             'per_page': 23,
-            'include_totals': 'true'
+            'include_totals': 'true',
+            'client_id': None,
+        })
+
+        # With client_id param
+        c.all(client_id='exampleid')
+
+        args, kwargs = mock_instance.get.call_args
+
+        self.assertEqual('https://domain/api/v2/client-grants', args[0])
+        self.assertEqual(kwargs['params'], {
+            'audience': None,
+            'page': None,
+            'per_page': None,
+            'include_totals': 'false',
+            'client_id': 'exampleid',
         })
 
     @mock.patch('auth0.v3.management.client_grants.RestClient')
diff --git a/auth0/v3/test/management/test_users_by_email.py b/auth0/v3/test/management/test_users_by_email.py
index 012c597..2c6e9af 100644
--- a/auth0/v3/test/management/test_users_by_email.py
+++ b/auth0/v3/test/management/test_users_by_email.py
@@ -16,7 +16,7 @@ class TestUsersByEmail(unittest.TestCase):
 
         self.assertEqual('https://domain/api/v2/users-by-email', args[0])
         self.assertEqual(kwargs['params'], {
-            'email': 'a@b.com',
+            'email': 'A@B.com',
             'fields': None,
             'include_fields': 'true'
         })