Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_same_id(self):
member = memberships.Member(self.m_manager, **self.data)
self.assertEqual(self.member, member)
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
def test_results_are_members(self):
for member in self.results.members:
with self.subTest(member=member):
self.assertIsInstance(member, memberships.Member)
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'])
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