Skip to content

Commit 607065f

Browse files
committed
now its ok
1 parent ea30c5d commit 607065f

File tree

6 files changed

+155
-186
lines changed

6 files changed

+155
-186
lines changed

poetry.lock

Lines changed: 98 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/management/test_fga.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def test_save_schema(self):
3131
)
3232

3333
# Test failed save_schema
34-
with patch("requests.post") as mock_post:
34+
with patch("httpx.post") as mock_post:
3535
mock_post.return_value.ok = False
3636
self.assertRaises(AuthException, client.mgmt.fga.save_schema, "")
3737

3838
# Test success flow
39-
with patch("requests.post") as mock_post:
39+
with patch("httpx.post") as mock_post:
4040
mock_post.return_value.ok = True
4141
self.assertIsNone(client.mgmt.fga.save_schema("model AuthZ 1.0"))
4242
mock_post.assert_called_with(
@@ -48,7 +48,7 @@ def test_save_schema(self):
4848
},
4949
params=None,
5050
json={"dsl": "model AuthZ 1.0"},
51-
allow_redirects=False,
51+
follow_redirects=False,
5252
verify=True,
5353
timeout=DEFAULT_TIMEOUT_SECONDS,
5454
)
@@ -62,12 +62,12 @@ def test_create_relations(self):
6262
)
6363

6464
# Test failed create_relations
65-
with patch("requests.post") as mock_post:
65+
with patch("httpx.post") as mock_post:
6666
mock_post.return_value.ok = False
6767
self.assertRaises(AuthException, client.mgmt.fga.create_relations, [])
6868

6969
# Test success flow
70-
with patch("requests.post") as mock_post:
70+
with patch("httpx.post") as mock_post:
7171
mock_post.return_value.ok = True
7272
self.assertIsNone(
7373
client.mgmt.fga.create_relations(
@@ -101,7 +101,7 @@ def test_create_relations(self):
101101
}
102102
]
103103
},
104-
allow_redirects=False,
104+
follow_redirects=False,
105105
verify=True,
106106
timeout=DEFAULT_TIMEOUT_SECONDS,
107107
)
@@ -115,12 +115,12 @@ def test_delete_relations(self):
115115
)
116116

117117
# Test failed delete_relations
118-
with patch("requests.post") as mock_post:
118+
with patch("httpx.post") as mock_post:
119119
mock_post.return_value.ok = False
120120
self.assertRaises(AuthException, client.mgmt.fga.delete_relations, [])
121121

122122
# Test success flow
123-
with patch("requests.post") as mock_post:
123+
with patch("httpx.post") as mock_post:
124124
mock_post.return_value.ok = True
125125
self.assertIsNone(
126126
client.mgmt.fga.delete_relations(
@@ -154,7 +154,7 @@ def test_delete_relations(self):
154154
}
155155
]
156156
},
157-
allow_redirects=False,
157+
follow_redirects=False,
158158
verify=True,
159159
timeout=DEFAULT_TIMEOUT_SECONDS,
160160
)
@@ -168,12 +168,12 @@ def test_check(self):
168168
)
169169

170170
# Test failed has_relations
171-
with patch("requests.post") as mock_post:
171+
with patch("httpx.post") as mock_post:
172172
mock_post.return_value.ok = False
173173
self.assertRaises(AuthException, client.mgmt.fga.check, [])
174174

175175
# Test success flow
176-
with patch("requests.post") as mock_post:
176+
with patch("httpx.post") as mock_post:
177177
mock_post.return_value.ok = True
178178
self.assertIsNotNone(
179179
client.mgmt.fga.check(
@@ -207,7 +207,7 @@ def test_check(self):
207207
}
208208
]
209209
},
210-
allow_redirects=False,
210+
follow_redirects=False,
211211
verify=True,
212212
timeout=DEFAULT_TIMEOUT_SECONDS,
213213
)
@@ -225,7 +225,7 @@ def test_load_resources_details_success(self):
225225
{"resourceId": "r2", "resourceType": "type2", "displayName": "Name2"},
226226
]
227227
}
228-
with patch("requests.post") as mock_post:
228+
with patch("httpx.post") as mock_post:
229229
mock_post.return_value.ok = True
230230
mock_post.return_value.json.return_value = response_body
231231
ids = [
@@ -243,7 +243,7 @@ def test_load_resources_details_success(self):
243243
},
244244
params=None,
245245
json={"resourceIdentifiers": ids},
246-
allow_redirects=False,
246+
follow_redirects=False,
247247
verify=True,
248248
timeout=DEFAULT_TIMEOUT_SECONDS,
249249
)
@@ -255,7 +255,7 @@ def test_load_resources_details_error(self):
255255
False,
256256
self.dummy_management_key,
257257
)
258-
with patch("requests.post") as mock_post:
258+
with patch("httpx.post") as mock_post:
259259
mock_post.return_value.ok = False
260260
ids = [{"resourceId": "r1", "resourceType": "type1"}]
261261
self.assertRaises(
@@ -274,7 +274,7 @@ def test_save_resources_details_success(self):
274274
details = [
275275
{"resourceId": "r1", "resourceType": "type1", "displayName": "Name1"}
276276
]
277-
with patch("requests.post") as mock_post:
277+
with patch("httpx.post") as mock_post:
278278
mock_post.return_value.ok = True
279279
client.mgmt.fga.save_resources_details(details)
280280
mock_post.assert_called_with(
@@ -286,7 +286,7 @@ def test_save_resources_details_success(self):
286286
},
287287
params=None,
288288
json={"resourcesDetails": details},
289-
allow_redirects=False,
289+
follow_redirects=False,
290290
verify=True,
291291
timeout=DEFAULT_TIMEOUT_SECONDS,
292292
)
@@ -301,7 +301,7 @@ def test_save_resources_details_error(self):
301301
details = [
302302
{"resourceId": "r1", "resourceType": "type1", "displayName": "Name1"}
303303
]
304-
with patch("requests.post") as mock_post:
304+
with patch("httpx.post") as mock_post:
305305
mock_post.return_value.ok = False
306306
self.assertRaises(
307307
AuthException,

tests/management/test_jwt.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_update_jwt(self):
6464
"customClaims": {"k1": "v1"},
6565
"refreshDuration": 40,
6666
},
67-
allow_redirects=False,
67+
follow_redirects=False,
6868
verify=True,
6969
params=None,
7070
timeout=DEFAULT_TIMEOUT_SECONDS,
@@ -85,7 +85,6 @@ def test_update_jwt(self):
8585
"customClaims": {"k1": "v1"},
8686
"refreshDuration": 0,
8787
},
88-
json={"jwt": "test", "customClaims": {"k1": "v1"}},
8988
follow_redirects=False,
9089
verify=True,
9190
params=None,
@@ -154,7 +153,7 @@ def test_stop_impersonation(self):
154153
)
155154

156155
# Test failed flows
157-
with patch("requests.post") as mock_post:
156+
with patch("httpx.post") as mock_post:
158157
mock_post.return_value.ok = False
159158
self.assertRaises(
160159
AuthException,
@@ -163,7 +162,7 @@ def test_stop_impersonation(self):
163162
)
164163

165164
# Test success flow
166-
with patch("requests.post") as mock_post:
165+
with patch("httpx.post") as mock_post:
167166
network_resp = mock.Mock()
168167
network_resp.ok = True
169168
network_resp.json.return_value = json.loads("""{"jwt": "response"}""")
@@ -184,7 +183,7 @@ def test_stop_impersonation(self):
184183
"selectedTenant": None,
185184
"refreshDuration": None,
186185
},
187-
allow_redirects=False,
186+
follow_redirects=False,
188187
verify=True,
189188
params=None,
190189
timeout=DEFAULT_TIMEOUT_SECONDS,
@@ -209,7 +208,7 @@ def test_sign_in(self):
209208
)
210209

211210
# Test success flow
212-
with patch("requests.post") as mock_post:
211+
with patch("httpx.post") as mock_post:
213212
network_resp = mock.Mock()
214213
network_resp.ok = True
215214
network_resp.json.return_value = json.loads("""{"jwt": "response"}""")
@@ -232,7 +231,7 @@ def test_sign_in(self):
232231
"jwt": None,
233232
"refreshDuration": None,
234233
},
235-
allow_redirects=False,
234+
follow_redirects=False,
236235
verify=True,
237236
params=None,
238237
timeout=DEFAULT_TIMEOUT_SECONDS,
@@ -250,7 +249,7 @@ def test_sign_up(self):
250249
self.assertRaises(AuthException, client.mgmt.jwt.sign_up, "")
251250

252251
# Test success flow
253-
with patch("requests.post") as mock_post:
252+
with patch("httpx.post") as mock_post:
254253
network_resp = mock.Mock()
255254
network_resp.ok = True
256255
network_resp.json.return_value = json.loads("""{"jwt": "response"}""")
@@ -283,7 +282,7 @@ def test_sign_up(self):
283282
"customClaims": None,
284283
"refreshDuration": None,
285284
},
286-
allow_redirects=False,
285+
follow_redirects=False,
287286
verify=True,
288287
params=None,
289288
timeout=DEFAULT_TIMEOUT_SECONDS,
@@ -301,7 +300,7 @@ def test_sign_up_or_in(self):
301300
self.assertRaises(AuthException, client.mgmt.jwt.sign_up_or_in, "")
302301

303302
# Test success flow
304-
with patch("requests.post") as mock_post:
303+
with patch("httpx.post") as mock_post:
305304
network_resp = mock.Mock()
306305
network_resp.ok = True
307306
network_resp.json.return_value = json.loads("""{"jwt": "response"}""")
@@ -334,7 +333,7 @@ def test_sign_up_or_in(self):
334333
"customClaims": None,
335334
"refreshDuration": None,
336335
},
337-
allow_redirects=False,
336+
follow_redirects=False,
338337
verify=True,
339338
params=None,
340339
timeout=DEFAULT_TIMEOUT_SECONDS,
@@ -349,7 +348,7 @@ def test_anonymous(self):
349348
)
350349

351350
# Test success flow
352-
with patch("requests.post") as mock_post:
351+
with patch("httpx.post") as mock_post:
353352
network_resp = mock.Mock()
354353
network_resp.ok = True
355354
network_resp.json.return_value = json.loads("""{"jwt": "response"}""")
@@ -368,7 +367,7 @@ def test_anonymous(self):
368367
"selectedTenant": "id",
369368
"refreshDuration": None,
370369
},
371-
allow_redirects=False,
370+
follow_redirects=False,
372371
verify=True,
373372
params=None,
374373
timeout=DEFAULT_TIMEOUT_SECONDS,

tests/management/test_role.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def test_create(self):
4444
# Test success flow
4545
with patch("httpx.post") as mock_post:
4646
mock_post.return_value.ok = True
47-
self.assertIsNone(client.mgmt.role.create("R1", "Something", ["P1"], "t1", True))
47+
self.assertIsNone(
48+
client.mgmt.role.create("R1", "Something", ["P1"], "t1", True)
49+
)
4850
mock_post.assert_called_with(
4951
f"{common.DEFAULT_BASE_URL}{MgmtV1.role_create_path}",
5052
headers={

0 commit comments

Comments
 (0)