@@ -185,18 +185,41 @@ def test_get_organization(self, mock_organization, mock_request_method):
185185
186186 assert organization == mock_organization
187187
188- def test_create_organization (self , mock_organization , mock_request_method ):
188+ def test_create_organization_with_domain_data (
189+ self , mock_organization , mock_request_method
190+ ):
189191 mock_request_method ("post" , mock_organization , 201 )
190192
191- payload = {"domains" : ["example.com" ], "name" : "Test Organization" }
193+ payload = {
194+ "domain_data" : [{"domain" : "example.com" , "state" : "verified" }],
195+ "name" : "Test Organization" ,
196+ }
192197 organization = self .organizations .create_organization (payload )
193198
194199 assert organization ["id" ] == "org_01EHT88Z8J8795GZNQ4ZP1J81T"
195200 assert organization ["name" ] == "Foo Corporation"
196201
202+ def test_create_organization_with_domains (
203+ self , mock_organization , mock_request_method
204+ ):
205+ mock_request_method ("post" , mock_organization , 201 )
206+
207+ payload = {"domains" : ["example.com" ], "name" : "Test Organization" }
208+ with pytest .warns (
209+ DeprecationWarning ,
210+ match = "The 'domains' parameter for 'create_organization' is deprecated." ,
211+ ):
212+ organization = self .organizations .create_organization (payload )
213+
214+ assert organization ["id" ] == "org_01EHT88Z8J8795GZNQ4ZP1J81T"
215+ assert organization ["name" ] == "Foo Corporation"
216+
197217 def test_sends_idempotency_key (self , capture_and_mock_request ):
198218 idempotency_key = "test_123456789"
199- payload = {"domains" : ["example.com" ], "name" : "Foo Corporation" }
219+ payload = {
220+ "domain_data" : [{"domain" : "example.com" , "state" : "verified" }],
221+ "name" : "Foo Corporation" ,
222+ }
200223
201224 _ , request_kwargs = capture_and_mock_request ("post" , payload , 200 )
202225
@@ -207,13 +230,15 @@ def test_sends_idempotency_key(self, capture_and_mock_request):
207230 assert request_kwargs ["headers" ]["idempotency-key" ] == idempotency_key
208231 assert response ["name" ] == "Foo Corporation"
209232
210- def test_update_organization (self , mock_organization_updated , mock_request_method ):
233+ def test_update_organization_with_domain_data (
234+ self , mock_organization_updated , mock_request_method
235+ ):
211236 mock_request_method ("put" , mock_organization_updated , 201 )
212237
213238 updated_organization = self .organizations .update_organization (
214239 organization = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
215240 name = "Example Organization" ,
216- domains = [ " example.io" ],
241+ domain_data = [{ "domain" : " example.io", "state" : "verified" } ],
217242 allow_profiles_outside_organization = True ,
218243 )
219244
@@ -228,6 +253,33 @@ def test_update_organization(self, mock_organization_updated, mock_request_metho
228253 ]
229254 assert updated_organization ["allow_profiles_outside_organization" ]
230255
256+ def test_update_organization_with_domains (
257+ self , mock_organization_updated , mock_request_method
258+ ):
259+ mock_request_method ("put" , mock_organization_updated , 201 )
260+
261+ with pytest .warns (
262+ DeprecationWarning ,
263+ match = "The 'domains' parameter for 'update_organization' is deprecated." ,
264+ ):
265+ updated_organization = self .organizations .update_organization (
266+ organization = "org_01EHT88Z8J8795GZNQ4ZP1J81T" ,
267+ name = "Example Organization" ,
268+ domains = ["example.io" ],
269+ allow_profiles_outside_organization = True ,
270+ )
271+
272+ assert updated_organization ["id" ] == "org_01EHT88Z8J8795GZNQ4ZP1J81T"
273+ assert updated_organization ["name" ] == "Example Organization"
274+ assert updated_organization ["domains" ] == [
275+ {
276+ "domain" : "example.io" ,
277+ "object" : "organization_domain" ,
278+ "id" : "org_domain_01EHT88Z8WZEFWYPM6EC9BX2R8" ,
279+ }
280+ ]
281+ assert updated_organization ["allow_profiles_outside_organization" ]
282+
231283 def test_delete_organization (self , setup , mock_raw_request_method ):
232284 mock_raw_request_method (
233285 "delete" ,
0 commit comments