@@ -251,4 +251,64 @@ def test_delete_organization_member_roles(self, mock_rc):
251251 mock_instance .delete .assert_called_with (
252252 'https://domain/api/v2/organizations/test-org/members/test-user/roles' ,
253253 data = {'a' : 'b' , 'c' : 'd' }
254- )
254+ )
255+
256+ # Organization Invitations
257+ @mock .patch ('auth0.v3.management.organizations.RestClient' )
258+ def test_all_organization_invitations (self , mock_rc ):
259+ mock_instance = mock_rc .return_value
260+
261+ c = Organizations (domain = 'domain' , token = 'jwttoken' )
262+
263+ # Default parameters are requested
264+ c .all_organization_invitations ('test-org' )
265+
266+ args , kwargs = mock_instance .get .call_args
267+
268+ self .assertEqual ('https://domain/api/v2/organizations/test-org/invitations' , args [0 ])
269+ self .assertEqual (kwargs ['params' ], {'page' : None ,
270+ 'per_page' : None })
271+
272+ # Specific pagination
273+ c .all_organization_invitations ('test-org' , page = 7 , per_page = 25 )
274+
275+ args , kwargs = mock_instance .get .call_args
276+
277+ self .assertEqual ('https://domain/api/v2/organizations/test-org/invitations' , args [0 ])
278+ self .assertEqual (kwargs ['params' ], {'page' : 7 ,
279+ 'per_page' : 25 })
280+
281+ @mock .patch ('auth0.v3.management.organizations.RestClient' )
282+ def test_get_organization_invitation (self , mock_rc ):
283+ mock_instance = mock_rc .return_value
284+
285+ c = Organizations (domain = 'domain' , token = 'jwttoken' )
286+ c .get_organization_invitation ('test-org' , 'test-inv' )
287+
288+ args , kwargs = mock_instance .get .call_args
289+
290+ self .assertEqual ('https://domain/api/v2/organizations/test-org/invitations/test-inv' , args [0 ])
291+ self .assertEqual (kwargs ['params' ], {})
292+
293+ @mock .patch ('auth0.v3.management.organizations.RestClient' )
294+ def test_create_organization_invitation (self , mock_rc ):
295+ mock_instance = mock_rc .return_value
296+
297+ c = Organizations (domain = 'domain' , token = 'jwttoken' )
298+ c .create_organization_invitation ('test-org' , {'a' : 'b' , 'c' : 'd' })
299+
300+ mock_instance .post .assert_called_with (
301+ 'https://domain/api/v2/organizations/test-org/invitations' ,
302+ data = {'a' : 'b' , 'c' : 'd' }
303+ )
304+
305+ @mock .patch ('auth0.v3.management.organizations.RestClient' )
306+ def test_delete_organization_invitation (self , mock_rc ):
307+ mock_instance = mock_rc .return_value
308+
309+ c = Organizations (domain = 'domain' , token = 'jwttoken' )
310+ c .delete_organization_invitation ('test-org' , 'test-inv' )
311+
312+ mock_instance .delete .assert_called_with (
313+ 'https://domain/api/v2/organizations/test-org/invitations/test-inv'
314+ )
0 commit comments