@@ -143,3 +143,46 @@ async def test_team_membership_and_invitations(self) -> None:
143143
144144 # Clean up
145145 test_team .delete ()
146+
147+ async def test_team_membership_status (self ) -> None :
148+ """Test getting user membership status in a team"""
149+ # GIVEN a team object
150+
151+ # WHEN I create the team on Synapse
152+ test_team = self .team .create ()
153+
154+ # AND I get the membership status for the creator (who should be a member)
155+ creator_status = test_team .get_user_membership_status (
156+ user_id = self .syn .getUserProfile ().ownerId
157+ )
158+
159+ # THEN the creator should have membership status indicating they are a member
160+ assert creator_status .is_member is True
161+ assert creator_status .team_id == str (test_team .id )
162+ assert creator_status .has_open_invitation is False
163+ assert creator_status .has_open_request is False
164+ assert creator_status .can_join is True
165+ assert creator_status .membership_approval_required is False
166+ assert creator_status .has_unmet_access_requirement is False
167+ assert creator_status .can_send_email is True
168+
169+ # WHEN I invite a test user to the team
170+ invite = await test_team .invite_async (
171+ user = self .TEST_USER ,
172+ message = self .TEST_MESSAGE ,
173+ )
174+ # Check the invited user's status
175+ invited_status = await test_team .get_user_membership_status_async (
176+ user_id = self .syn .getUserProfile (self .TEST_USER ).ownerId
177+ )
178+
179+ # THEN the invited user should show they have an open invitation
180+ assert invited_status is not None
181+ assert invited_status .team_id == str (test_team .id )
182+ assert invited_status .has_open_invitation is True
183+ assert invited_status .membership_approval_required is True
184+ assert invited_status .can_send_email is True
185+ assert invited_status .is_member is False
186+
187+ # Clean up
188+ test_team .delete ()
0 commit comments