How to use the groupy.api.memberships.Member function in groupy

To help you get started, we’ve selected a few groupy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhgrant10 / Groupy / tests / api / test_memberships.py View on Github external
def test_same_id(self):
        member = memberships.Member(self.m_manager, **self.data)
        self.assertEqual(self.member, member)
github rhgrant10 / Groupy / tests / api / test_memberships.py View on Github external
def setUp(self, *__):
        self.m_manager = mock.Mock()
        self.data = get_fake_member_data(group_id='foo_group_id')
        self.member = memberships.Member(self.m_manager, **self.data)
        self._blocks = self.member._user.blocks
        self._memberships = self.member._memberships
github rhgrant10 / Groupy / tests / api / test_memberships.py View on Github external
def test_results_are_members(self):
        for member in self.results.members:
            with self.subTest(member=member):
                self.assertIsInstance(member, memberships.Member)
github rhgrant10 / Groupy / groupy / api / groups.py View on Github external
def __init__(self, manager, **data):
        super().__init__(manager, **data)
        self.messages = messages.Messages(self.manager.session, self.id)
        self.gallery = messages.Gallery(self.manager.session, self.group_id)
        self.leaderboard = messages.Leaderboard(self.manager.session, self.id)
        self.memberships = memberships.Memberships(self.manager.session, self.id)
        self._bots = bots.Bots(self.manager.session)
        self._user = user.User(self.manager.session)

        members = self.data.get('members') or []
        self.members = [memberships.Member(self.manager, self.id, **m) for m in members]
        self.created_at = utils.get_datetime(self.data['created_at'])
        self.updated_at = utils.get_datetime(self.data['updated_at'])
github rhgrant10 / Groupy / groupy / api / memberships.py View on Github external
def get_new_members(self, results):
        """Return the newly added members.

        :param results: the results of a membership request check
        :type results: :class:`list`
        :return: the successful requests, as :class:`~groupy.api.memberships.Members`
        :rtype: generator
        """
        for member in results:
            guid = member.pop('guid')
            yield Member(self.manager, self.group_id, **member)
            member['guid'] = guid