def test_member_join_is_idempotent(self, db_session, group, users): svc = GroupService(db_session, users.get) svc.member_join(group, 'theresa') svc.member_join(group, 'theresa') assert group.members.count(users['theresa']) == 1
def test_member_join_publishes_join_event(self, db_session, group, users): publish = mock.Mock(spec_set=[]) svc = GroupService(db_session, users.get, publish=publish) group.pubid = 'abc123' svc.member_join(group, 'theresa') publish.assert_called_once_with('group-join', 'abc123', 'theresa')
def test_member_join_adds_user_to_group(self, db_session, group, users): svc = GroupService(db_session, users.get) svc.member_join(group, 'theresa') assert users['theresa'] in group.members