Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connections.all name parameter #500

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions auth0/management/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def all(
page=None,
per_page=None,
extra_params=None,
name=None,
):
"""Retrieves all connections.

Expand All @@ -76,6 +77,8 @@ def all(
the request. The fields, include_fields, page and per_page values
specified as parameters take precedence over the ones defined here.

name (str): Provide the name of the connection to retrieve.

See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections

Returns:
Expand All @@ -88,6 +91,7 @@ def all(
params["include_fields"] = str(include_fields).lower()
params["page"] = page
params["per_page"] = per_page
params["name"] = name

return self.client.get(self._url(), params=params)

Expand Down
23 changes: 23 additions & 0 deletions auth0/test/management/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_all(self, mock_rc):
"page": None,
"per_page": None,
"include_fields": "true",
"name": None,
},
)

Expand All @@ -50,6 +51,7 @@ def test_all(self, mock_rc):
"page": None,
"per_page": None,
"include_fields": "false",
"name": None,
},
)

Expand All @@ -67,6 +69,7 @@ def test_all(self, mock_rc):
"page": None,
"per_page": None,
"include_fields": "true",
"name": None,
},
)

Expand All @@ -84,6 +87,7 @@ def test_all(self, mock_rc):
"page": 7,
"per_page": 25,
"include_fields": "true",
"name": None,
},
)

Expand All @@ -102,6 +106,25 @@ def test_all(self, mock_rc):
"per_page": None,
"include_fields": "true",
"some_key": "some_value",
"name": None,
},
)

# Name
c.all(name="foo")

args, kwargs = mock_instance.get.call_args

self.assertEqual("https://domain/api/v2/connections", args[0])
self.assertEqual(
kwargs["params"],
{
"fields": None,
"strategy": None,
"page": None,
"per_page": None,
"include_fields": "true",
"name": "foo",
},
)

Expand Down