@@ -263,6 +263,44 @@ async def test_teams_join_leave(anc_any):
263263 await anc_any .teams .destroy (circle .circle_id )
264264
265265
266+ @pytest .mark .asyncio (scope = "session" )
267+ async def test_teams_confirm_member (anc_any ):
268+ if await anc_any .teams .available is False :
269+ pytest .skip ("Teams (Circles) is not installed" )
270+ test_user_id = environ .get ("TEST_USER_ID" , "" )
271+ test_user_pass = environ .get ("TEST_USER_PASS" , "" )
272+ if not test_user_id or not test_user_pass :
273+ pytest .skip ("No test user available" )
274+ circle = await anc_any .teams .create ("test_nc_py_api_team_cm" )
275+ try :
276+ await anc_any .teams .edit_config (circle .circle_id , CircleConfig .VISIBLE | CircleConfig .REQUEST )
277+
278+ from nc_py_api import AsyncNextcloud
279+
280+ anc_user = AsyncNextcloud (
281+ nextcloud_url = environ ["NEXTCLOUD_URL" ],
282+ nc_auth_user = test_user_id ,
283+ nc_auth_pass = test_user_pass ,
284+ )
285+ await anc_user .teams .join (circle .circle_id )
286+
287+ members = await anc_any .teams .get_members (circle .circle_id )
288+ requesting = next (m for m in members if m .user_id == test_user_id )
289+ assert requesting .status == "Requesting"
290+
291+ confirmed = await anc_any .teams .confirm_member (circle .circle_id , requesting .member_id )
292+ assert isinstance (confirmed , Member )
293+ assert confirmed .user_id == test_user_id
294+
295+ members = await anc_any .teams .get_members (circle .circle_id )
296+ member = next (m for m in members if m .user_id == test_user_id )
297+ assert member .status == "Member"
298+ assert member .level == MemberLevel .MEMBER
299+ finally :
300+ with contextlib .suppress (NextcloudException ):
301+ await anc_any .teams .destroy (circle .circle_id )
302+
303+
266304@pytest .mark .asyncio (scope = "session" )
267305async def test_teams_destroy_nonexistent (anc_any ):
268306 if await anc_any .teams .available is False :
0 commit comments