# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/api/attachments.py
# class AttachmentMeta(type):
# class Attachment(base.Resource, metaclass=AttachmentMeta):
# class Location(Attachment):
# class Split(Attachment):
# class Emoji(Attachment):
# class Mentions(Attachment):
# class Image(Attachment):
# class LinkedImage(Image):
# class Images(base.Manager):
#     def __init__(cls, name, bases, attrs):
#     def __init__(self, type, **data):
#     def to_json(self):
#     def from_data(cls, type, **data):
#     def from_bulk_data(cls, attachments):
#     def __init__(self, lat, lng, name, foursqure_venue_id=None):
#     def __init__(self, token):
#     def __init__(self, placeholder, charmap):
#     def __init__(self, loci=None, user_ids=None):
#     def __init__(self, url, source_url=None, file_id=None):
#     def from_file(self, fp):
#     def upload(self, fp):
#     def download(self, image, url_field='url', suffix=None):
#     def download_preview(self, image, url_field='url'):
#     def download_large(self, image, url_field='url'):
#     def download_avatar(self, image, url_field='url'):
# 
# Path: groupy/api/messages.py
# class Messages(base.Manager):
# class DirectMessages(base.Manager):
# class GenericMessage(base.ManagedResource):
# class Message(GenericMessage):
# class DirectMessage(GenericMessage):
# class Leaderboard(base.Manager):
# class Likes(base.Manager):
# class Gallery(base.Manager):
#     def __init__(self, session, group_id):
#     def _raw_list(self, **params):
#     def list(self, before_id=None, since_id=None, after_id=None, limit=20):
#     def list_before(self, message_id, limit=None):
#     def list_since(self, message_id, limit=None):
#     def list_after(self, message_id, limit=None):
#     def list_all(self, limit=None):
#     def list_all_before(self, message_id, limit=None):
#     def list_all_after(self, message_id, limit=None):
#     def create(self, text=None, attachments=None, source_guid=None):
#     def __init__(self, session, other_user_id):
#     def _raw_list(self, **params):
#     def list(self, before_id=None, since_id=None, **kwargs):
#     def list_before(self, message_id, **kwargs):
#     def list_since(self, message_id, **kwargs):
#     def list_all(self, before_id=None, since_id=None, **kwargs):
#     def list_all_before(self, message_id, **kwargs):
#     def create(self, text=None, attachments=None, source_guid=None):
#     def __init__(self, manager, conversation_id, **data):
#     def __repr__(self):
#     def __eq__(self, other):
#     def like(self):
#     def unlike(self):
#     def __init__(self, manager, **data):
#     def __init__(self, manager, **data):
#     def get_conversation_id(data):
#     def __init__(self, session, group_id):
#     def _get_messages(self, path=None, **params):
#     def list(self, period):
#     def list_day(self):
#     def list_week(self):
#     def list_month(self):
#     def list_mine(self):
#     def list_for_me(self):
#     def __init__(self, session, conversation_id, message_id):
#     def like(self):
#     def unlike(self):
#     def __init__(self, session, group_id):
#     def _raw_list(self, **params):
#     def _convert_to_rfc3339(self, when=None):
#     def list(self, before=None, since=None, after=None, limit=100):
#     def list_before(self, when, limit=100):
#     def list_since(self, when, limit=100):
#     def list_after(self, when, limit=100):
#     def list_all(self, **params):
#     def list_all_before(self, when, limit=100):
#     def list_all_after(self, when, limit=100):


from unittest import mock
from datetime import datetime
from groupy import utils
from groupy.api import attachments
from groupy.api import messages
from . import base

class RawListGalleryTests(GalleryTests):
    def setUp(self):
        super().setUp()
        message = base.get_fake_message_data()
        response = base.get_fake_response(data={'messages': [message]},
                                          code=self.code)
        self.m_session.get.return_value = response
        self.results = self.gallery._raw_list()


class NonemptyRawListGalleryTests(RawListGalleryTests):
    code = 200

    def test_results_are_messages(self):
        self.assertTrue(all(isinstance(m, messages.GenericMessage) for m in self.results))


class EmptyRawListGalleryTests(RawListGalleryTests):
    code = 304

    def test_results_are_empty(self):
        self.assertEqual(self.results, [])


class ListMethodGalleryTests(GalleryTests):
    def setUp(self):
        super().setUp()
        self.gallery._raw_list = mock.Mock()
        self.when = datetime.now()

# Path: groupy/utils.py
# def urljoin(base, path=None):
# def parse_share_url(share_url):
# def get_rfc3339(when):
# def get_datetime(timestamp):
#     def __init__(self, key, value):
#     def __repr__(self):
#     def __call__(self, obj):
#     def __init__(self, tests):
#     def __call__(self, objects):
#     def find(self, objects):
#     def passes(self, obj):
# def make_filter(**tests):
# class AttrTest:
# class Filter:
# 
# Path: groupy/api/attachments.py
# class AttachmentMeta(type):
# class Attachment(base.Resource, metaclass=AttachmentMeta):
# class Location(Attachment):
# class Split(Attachment):
# class Emoji(Attachment):
# class Mentions(Attachment):
# class Image(Attachment):
# class LinkedImage(Image):
# class Images(base.Manager):
#     def __init__(cls, name, bases, attrs):
#     def __init__(self, type, **data):
#     def to_json(self):
#     def from_data(cls, type, **data):
#     def from_bulk_data(cls, attachments):
#     def __init__(self, lat, lng, name, foursqure_venue_id=None):
#     def __init__(self, token):
#     def __init__(self, placeholder, charmap):
#     def __init__(self, loci=None, user_ids=None):
#     def __init__(self, url, source_url=None, file_id=None):
#     def from_file(self, fp):
#     def upload(self, fp):
#     def download(self, image, url_field='url', suffix=None):
#     def download_preview(self, image, url_field='url'):
#     def download_large(self, image, url_field='url'):
#     def download_avatar(self, image, url_field='url'):
# 
# Path: groupy/api/messages.py
# class Messages(base.Manager):
# class DirectMessages(base.Manager):
# class GenericMessage(base.ManagedResource):
# class Message(GenericMessage):
# class DirectMessage(GenericMessage):
# class Leaderboard(base.Manager):
# class Likes(base.Manager):
# class Gallery(base.Manager):
#     def __init__(self, session, group_id):
#     def _raw_list(self, **params):
#     def list(self, before_id=None, since_id=None, after_id=None, limit=20):
#     def list_before(self, message_id, limit=None):
#     def list_since(self, message_id, limit=None):
#     def list_after(self, message_id, limit=None):
#     def list_all(self, limit=None):
#     def list_all_before(self, message_id, limit=None):
#     def list_all_after(self, message_id, limit=None):
#     def create(self, text=None, attachments=None, source_guid=None):
#     def __init__(self, session, other_user_id):
#     def _raw_list(self, **params):
#     def list(self, before_id=None, since_id=None, **kwargs):
#     def list_before(self, message_id, **kwargs):
#     def list_since(self, message_id, **kwargs):
#     def list_all(self, before_id=None, since_id=None, **kwargs):
#     def list_all_before(self, message_id, **kwargs):
#     def create(self, text=None, attachments=None, source_guid=None):
#     def __init__(self, manager, conversation_id, **data):
#     def __repr__(self):
#     def __eq__(self, other):
#     def like(self):
#     def unlike(self):
#     def __init__(self, manager, **data):
#     def __init__(self, manager, **data):
#     def get_conversation_id(data):
#     def __init__(self, session, group_id):
#     def _get_messages(self, path=None, **params):
#     def list(self, period):
#     def list_day(self):
#     def list_week(self):
#     def list_month(self):
#     def list_mine(self):
#     def list_for_me(self):
#     def __init__(self, session, conversation_id, message_id):
#     def like(self):
#     def unlike(self):
#     def __init__(self, session, group_id):
#     def _raw_list(self, **params):
#     def _convert_to_rfc3339(self, when=None):
#     def list(self, before=None, since=None, after=None, limit=100):
#     def list_before(self, when, limit=100):
#     def list_since(self, when, limit=100):
#     def list_after(self, when, limit=100):
#     def list_all(self, **params):
#     def list_all_before(self, when, limit=100):
#     def list_all_after(self, when, limit=100):


# Path: tests/api/test_messages.py
from unittest import mock
from datetime import datetime
from groupy import utils
from groupy.api import attachments
from groupy.api import messages
from . import base


class RawListGalleryTests(GalleryTests):
    def setUp(self):
        super().setUp()
        message = base.get_fake_message_data()
        response = base.get_fake_response(data={'messages': [message]},
                                          code=self.code)
        self.m_session.get.return_value = response
        self.results = self.gallery._raw_list()


class NonemptyRawListGalleryTests(RawListGalleryTests):
    code = 200

    def test_results_are_messages(self):
        self.assertTrue(all(isinstance(m, messages.GenericMessage) for m in self.results))


class EmptyRawListGalleryTests(RawListGalleryTests):
    code = 304

    def test_results_are_empty(self):
        self.assertEqual(self.results, [])


class ListMethodGalleryTests(GalleryTests):
    def setUp(self):
        super().setUp()
        self.gallery._raw_list = mock.Mock()
        self.when = datetime.now()

        self.ts = utils.get_rfc3339(self.when)