# Path: pupa/scrape/event.py
# class Event(BaseModel, SourceMixin, AssociatedLinkMixin, LinkMixin):
#     """
#     Details for an event in .format
#     """
#     _type = 'event'
#     _schema = schema
# 
#     def __init__(self, name, start_date, *,
#                  location_name=None,
#                  all_day=False, description="", end_date="",
#                  status="confirmed", classification="event"
#                  ):
#         super(Event, self).__init__()
#         self.start_date = start_date
#         self.all_day = all_day
#         self.end_date = end_date
#         self.name = name
#         self.description = description
#         self.status = status
#         self.classification = classification
#         if location_name:
#             self.location = {"name": location_name, "note": "", "coordinates": None}
#         else:
#             self.location = None
#         self.documents = []
#         self.participants = []
#         self.media = []
#         self.agenda = []
# 
#     def __str__(self):
#         return '{} {}'.format(self.start_date, self.name.strip())
# 
#     def set_location(self, name, *, note="", url="", coordinates=None):
#         self.location = {"name": name, "note": note, "url": url, "coordinates": coordinates}
# 
#     def add_participant(self, name, type, *, id=None, note='participant'):
#         p = {
#             "name": name,
#             "entity_type": type,
#             "note": note
#         }
#         if id:
#             p['id'] = id
#         elif type:
#             id = _make_pseudo_id(name=name)
#             p[type + '_id'] = id
# 
#         self.participants.append(p)
# 
#     def add_person(self, name, *, id=None, note='participant'):
#         return self.add_participant(name=name, type='person', id=id, note=note)
# 
#     def add_committee(self, name, *, id=None, note='participant'):
#         return self.add_participant(name=name, type='organization', id=id, note=note)
# 
#     def add_agenda_item(self, description):
#         obj = EventAgendaItem(description, self)
#         self.agenda.append(obj)
#         return obj
# 
#     def add_media_link(self, note, url, media_type, *, text='',
#                        type='media', on_duplicate='error', date=''):
#         return self._add_associated_link(collection='media',
#                                          note=note,
#                                          url=url,
#                                          text=text,
#                                          media_type=media_type,
#                                          on_duplicate=on_duplicate,
#                                          date=date)
# 
#     def add_document(self, note, url, *, text='', media_type='', on_duplicate='error', date=''):
#         return self._add_associated_link(collection='documents',
#                                          note=note, url=url,
#                                          text=text,
#                                          media_type=media_type,
#                                          on_duplicate=on_duplicate,
#                                          date=date)


import pytest
import datetime
from pupa.scrape import Event


def event_obj():
    e = Event(
        name="get-together",
        start_date=datetime.datetime.utcnow().isoformat().split('.')[0] + 'Z',
        location_name="Joe's Place",
    )
    e.add_source(url='http://example.com/foobar')
    return e


def test_basic_event():
    e = event_obj()
    e.validate()


def test_no_location():

# Path: pupa/scrape/event.py
# class Event(BaseModel, SourceMixin, AssociatedLinkMixin, LinkMixin):
#     """
#     Details for an event in .format
#     """
#     _type = 'event'
#     _schema = schema
# 
#     def __init__(self, name, start_date, *,
#                  location_name=None,
#                  all_day=False, description="", end_date="",
#                  status="confirmed", classification="event"
#                  ):
#         super(Event, self).__init__()
#         self.start_date = start_date
#         self.all_day = all_day
#         self.end_date = end_date
#         self.name = name
#         self.description = description
#         self.status = status
#         self.classification = classification
#         if location_name:
#             self.location = {"name": location_name, "note": "", "coordinates": None}
#         else:
#             self.location = None
#         self.documents = []
#         self.participants = []
#         self.media = []
#         self.agenda = []
# 
#     def __str__(self):
#         return '{} {}'.format(self.start_date, self.name.strip())
# 
#     def set_location(self, name, *, note="", url="", coordinates=None):
#         self.location = {"name": name, "note": note, "url": url, "coordinates": coordinates}
# 
#     def add_participant(self, name, type, *, id=None, note='participant'):
#         p = {
#             "name": name,
#             "entity_type": type,
#             "note": note
#         }
#         if id:
#             p['id'] = id
#         elif type:
#             id = _make_pseudo_id(name=name)
#             p[type + '_id'] = id
# 
#         self.participants.append(p)
# 
#     def add_person(self, name, *, id=None, note='participant'):
#         return self.add_participant(name=name, type='person', id=id, note=note)
# 
#     def add_committee(self, name, *, id=None, note='participant'):
#         return self.add_participant(name=name, type='organization', id=id, note=note)
# 
#     def add_agenda_item(self, description):
#         obj = EventAgendaItem(description, self)
#         self.agenda.append(obj)
#         return obj
# 
#     def add_media_link(self, note, url, media_type, *, text='',
#                        type='media', on_duplicate='error', date=''):
#         return self._add_associated_link(collection='media',
#                                          note=note,
#                                          url=url,
#                                          text=text,
#                                          media_type=media_type,
#                                          on_duplicate=on_duplicate,
#                                          date=date)
# 
#     def add_document(self, note, url, *, text='', media_type='', on_duplicate='error', date=''):
#         return self._add_associated_link(collection='documents',
#                                          note=note, url=url,
#                                          text=text,
#                                          media_type=media_type,
#                                          on_duplicate=on_duplicate,
#                                          date=date)


# Path: pupa/tests/scrape/test_event_scrape.py
import pytest
import datetime
from pupa.scrape import Event



def event_obj():
    e = Event(
        name="get-together",
        start_date=datetime.datetime.utcnow().isoformat().split('.')[0] + 'Z',
        location_name="Joe's Place",
    )
    e.add_source(url='http://example.com/foobar')
    return e


def test_basic_event():
    e = event_obj()
    e.validate()


def test_no_location():

    e = Event(