2323
2424
2525class TestApiKeys :
26- def test_create_validations (self , workos , httpx_mock ):
26+ def test_create_validation (self , workos , httpx_mock ):
2727 httpx_mock .add_response (
2828 json = load_fixture ("api_key_validation_response.json" ),
2929 )
30- result = workos .api_keys .create_validations (value = "test_value" )
30+ result = workos .api_keys .create_validation (value = "test_value" )
3131 assert isinstance (result , ApiKeyValidationResponse )
3232 request = httpx_mock .get_request ()
3333 assert request .method == "POST"
@@ -72,11 +72,11 @@ def test_list_organization_api_keys_encodes_query_params(self, workos, httpx_moc
7272 assert request .url .params ["after" ] == "cursor/after"
7373 assert request .url .params ["order" ] == "normal"
7474
75- def test_create_organization_api_keys (self , workos , httpx_mock ):
75+ def test_create_organization_api_key (self , workos , httpx_mock ):
7676 httpx_mock .add_response (
7777 json = load_fixture ("api_key_with_value.json" ),
7878 )
79- result = workos .api_keys .create_organization_api_keys (
79+ result = workos .api_keys .create_organization_api_key (
8080 "test_organizationId" , name = "test_name"
8181 )
8282 assert isinstance (result , ApiKeyWithValue )
@@ -88,34 +88,34 @@ def test_create_organization_api_keys(self, workos, httpx_mock):
8888 body = json .loads (request .content )
8989 assert body ["name" ] == "test_name"
9090
91- def test_create_validations_with_request_options (self , workos , httpx_mock ):
91+ def test_create_validation_with_request_options (self , workos , httpx_mock ):
9292 httpx_mock .add_response (json = load_fixture ("api_key_validation_response.json" ))
93- workos .api_keys .create_validations (
93+ workos .api_keys .create_validation (
9494 value = "test_value" , request_options = {"extra_headers" : {"X-Custom" : "value" }}
9595 )
9696 request = httpx_mock .get_request ()
9797 assert request .headers ["X-Custom" ] == "value"
9898
99- def test_create_validations_unauthorized (self , workos , httpx_mock ):
99+ def test_create_validation_unauthorized (self , workos , httpx_mock ):
100100 httpx_mock .add_response (
101101 status_code = 401 ,
102102 json = {"message" : "Unauthorized" },
103103 )
104104 with pytest .raises (AuthenticationError ):
105- workos .api_keys .create_validations (value = "test_value" )
105+ workos .api_keys .create_validation (value = "test_value" )
106106
107- def test_create_validations_not_found (self , httpx_mock ):
107+ def test_create_validation_not_found (self , httpx_mock ):
108108 workos = WorkOSClient (
109109 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
110110 )
111111 try :
112112 httpx_mock .add_response (status_code = 404 , json = {"message" : "Not found" })
113113 with pytest .raises (NotFoundError ):
114- workos .api_keys .create_validations (value = "test_value" )
114+ workos .api_keys .create_validation (value = "test_value" )
115115 finally :
116116 workos .close ()
117117
118- def test_create_validations_rate_limited (self , httpx_mock ):
118+ def test_create_validation_rate_limited (self , httpx_mock ):
119119 workos = WorkOSClient (
120120 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
121121 )
@@ -126,49 +126,49 @@ def test_create_validations_rate_limited(self, httpx_mock):
126126 json = {"message" : "Slow down" },
127127 )
128128 with pytest .raises (RateLimitExceededError ):
129- workos .api_keys .create_validations (value = "test_value" )
129+ workos .api_keys .create_validation (value = "test_value" )
130130 finally :
131131 workos .close ()
132132
133- def test_create_validations_server_error (self , httpx_mock ):
133+ def test_create_validation_server_error (self , httpx_mock ):
134134 workos = WorkOSClient (
135135 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
136136 )
137137 try :
138138 httpx_mock .add_response (status_code = 500 , json = {"message" : "Server error" })
139139 with pytest .raises (ServerError ):
140- workos .api_keys .create_validations (value = "test_value" )
140+ workos .api_keys .create_validation (value = "test_value" )
141141 finally :
142142 workos .close ()
143143
144- def test_create_validations_bad_request (self , httpx_mock ):
144+ def test_create_validation_bad_request (self , httpx_mock ):
145145 workos = WorkOSClient (
146146 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
147147 )
148148 try :
149149 httpx_mock .add_response (status_code = 400 , json = {"message" : "Bad request" })
150150 with pytest .raises (BadRequestError ):
151- workos .api_keys .create_validations (value = "test_value" )
151+ workos .api_keys .create_validation (value = "test_value" )
152152 finally :
153153 workos .close ()
154154
155- def test_create_validations_unprocessable (self , httpx_mock ):
155+ def test_create_validation_unprocessable (self , httpx_mock ):
156156 workos = WorkOSClient (
157157 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
158158 )
159159 try :
160160 httpx_mock .add_response (status_code = 422 , json = {"message" : "Unprocessable" })
161161 with pytest .raises (UnprocessableEntityError ):
162- workos .api_keys .create_validations (value = "test_value" )
162+ workos .api_keys .create_validation (value = "test_value" )
163163 finally :
164164 workos .close ()
165165
166166
167167class TestAsyncApiKeys :
168168 @pytest .mark .asyncio
169- async def test_create_validations (self , async_workos , httpx_mock ):
169+ async def test_create_validation (self , async_workos , httpx_mock ):
170170 httpx_mock .add_response (json = load_fixture ("api_key_validation_response.json" ))
171- result = await async_workos .api_keys .create_validations (value = "test_value" )
171+ result = await async_workos .api_keys .create_validation (value = "test_value" )
172172 assert isinstance (result , ApiKeyValidationResponse )
173173 request = httpx_mock .get_request ()
174174 assert request .method == "POST"
@@ -222,9 +222,9 @@ async def test_list_organization_api_keys_encodes_query_params(
222222 assert request .url .params ["order" ] == "normal"
223223
224224 @pytest .mark .asyncio
225- async def test_create_organization_api_keys (self , async_workos , httpx_mock ):
225+ async def test_create_organization_api_key (self , async_workos , httpx_mock ):
226226 httpx_mock .add_response (json = load_fixture ("api_key_with_value.json" ))
227- result = await async_workos .api_keys .create_organization_api_keys (
227+ result = await async_workos .api_keys .create_organization_api_key (
228228 "test_organizationId" , name = "test_name"
229229 )
230230 assert isinstance (result , ApiKeyWithValue )
@@ -235,36 +235,36 @@ async def test_create_organization_api_keys(self, async_workos, httpx_mock):
235235 assert request .url .path .endswith ("/organizations/test_organizationId/api_keys" )
236236
237237 @pytest .mark .asyncio
238- async def test_create_validations_with_request_options (
238+ async def test_create_validation_with_request_options (
239239 self , async_workos , httpx_mock
240240 ):
241241 httpx_mock .add_response (json = load_fixture ("api_key_validation_response.json" ))
242- await async_workos .api_keys .create_validations (
242+ await async_workos .api_keys .create_validation (
243243 value = "test_value" , request_options = {"extra_headers" : {"X-Custom" : "value" }}
244244 )
245245 request = httpx_mock .get_request ()
246246 assert request .headers ["X-Custom" ] == "value"
247247
248248 @pytest .mark .asyncio
249- async def test_create_validations_unauthorized (self , async_workos , httpx_mock ):
249+ async def test_create_validation_unauthorized (self , async_workos , httpx_mock ):
250250 httpx_mock .add_response (status_code = 401 , json = {"message" : "Unauthorized" })
251251 with pytest .raises (AuthenticationError ):
252- await async_workos .api_keys .create_validations (value = "test_value" )
252+ await async_workos .api_keys .create_validation (value = "test_value" )
253253
254254 @pytest .mark .asyncio
255- async def test_create_validations_not_found (self , httpx_mock ):
255+ async def test_create_validation_not_found (self , httpx_mock ):
256256 workos = AsyncWorkOSClient (
257257 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
258258 )
259259 try :
260260 httpx_mock .add_response (status_code = 404 , json = {"message" : "Not found" })
261261 with pytest .raises (NotFoundError ):
262- await workos .api_keys .create_validations (value = "test_value" )
262+ await workos .api_keys .create_validation (value = "test_value" )
263263 finally :
264264 await workos .close ()
265265
266266 @pytest .mark .asyncio
267- async def test_create_validations_rate_limited (self , httpx_mock ):
267+ async def test_create_validation_rate_limited (self , httpx_mock ):
268268 workos = AsyncWorkOSClient (
269269 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
270270 )
@@ -275,42 +275,42 @@ async def test_create_validations_rate_limited(self, httpx_mock):
275275 json = {"message" : "Slow down" },
276276 )
277277 with pytest .raises (RateLimitExceededError ):
278- await workos .api_keys .create_validations (value = "test_value" )
278+ await workos .api_keys .create_validation (value = "test_value" )
279279 finally :
280280 await workos .close ()
281281
282282 @pytest .mark .asyncio
283- async def test_create_validations_server_error (self , httpx_mock ):
283+ async def test_create_validation_server_error (self , httpx_mock ):
284284 workos = AsyncWorkOSClient (
285285 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
286286 )
287287 try :
288288 httpx_mock .add_response (status_code = 500 , json = {"message" : "Server error" })
289289 with pytest .raises (ServerError ):
290- await workos .api_keys .create_validations (value = "test_value" )
290+ await workos .api_keys .create_validation (value = "test_value" )
291291 finally :
292292 await workos .close ()
293293
294294 @pytest .mark .asyncio
295- async def test_create_validations_bad_request (self , httpx_mock ):
295+ async def test_create_validation_bad_request (self , httpx_mock ):
296296 workos = AsyncWorkOSClient (
297297 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
298298 )
299299 try :
300300 httpx_mock .add_response (status_code = 400 , json = {"message" : "Bad request" })
301301 with pytest .raises (BadRequestError ):
302- await workos .api_keys .create_validations (value = "test_value" )
302+ await workos .api_keys .create_validation (value = "test_value" )
303303 finally :
304304 await workos .close ()
305305
306306 @pytest .mark .asyncio
307- async def test_create_validations_unprocessable (self , httpx_mock ):
307+ async def test_create_validation_unprocessable (self , httpx_mock ):
308308 workos = AsyncWorkOSClient (
309309 api_key = "sk_test_123" , client_id = "client_test" , max_retries = 0
310310 )
311311 try :
312312 httpx_mock .add_response (status_code = 422 , json = {"message" : "Unprocessable" })
313313 with pytest .raises (UnprocessableEntityError ):
314- await workos .api_keys .create_validations (value = "test_value" )
314+ await workos .api_keys .create_validation (value = "test_value" )
315315 finally :
316316 await workos .close ()
0 commit comments