Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16febb7

Browse files
committed
Pass rest_options through Auth0 constructor
1 parent 2b22ae4 commit 16febb7

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

auth0/v3/management/auth0.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@ def __init__(self, domain, token, rest_options=None):
8080

8181
for name, cls in modules.items():
8282
cls = asyncify(cls)
83-
setattr(self, name, cls(domain=domain, token=token, rest_options=None))
83+
setattr(
84+
self,
85+
name,
86+
cls(domain=domain, token=token, rest_options=rest_options),
87+
)
8488
else:
8589
for name, cls in modules.items():
86-
setattr(self, name, cls(domain=domain, token=token, rest_options=None))
90+
setattr(
91+
self,
92+
name,
93+
cls(domain=domain, token=token, rest_options=rest_options),
94+
)

auth0/v3/test/management/test_auth0.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import unittest
22

3+
import mock
4+
35
from ...management.actions import Actions
46
from ...management.attack_protection import AttackProtection
57
from ...management.auth0 import Auth0
@@ -29,6 +31,7 @@
2931
from ...management.user_blocks import UserBlocks
3032
from ...management.users import Users
3133
from ...management.users_by_email import UsersByEmail
34+
from ...rest import RestClientOptions
3235

3336

3437
class TestAuth0(unittest.TestCase):
@@ -120,3 +123,16 @@ def test_users_by_email(self):
120123

121124
def test_users(self):
122125
self.assertIsInstance(self.a0.users, Users)
126+
127+
@mock.patch("auth0.v3.management.users.Users.__init__")
128+
def test_args(self, users):
129+
rest_options = RestClientOptions(retries=99)
130+
Auth0(self.domain, self.token, rest_options=rest_options)
131+
users.assert_called_with(
132+
"user.some.domain",
133+
"a-token",
134+
True,
135+
5.0,
136+
"https",
137+
rest_options,
138+
)

0 commit comments

Comments
 (0)