def test_conflict(log_parser_class):
    """Test recognizing a conflict."""
    parser = log_parser_class(
            "Conflict(start_time='2019-08-05 19:00:00', end_time='2019-08-05 " \
            "21:00:00', events=[Event(meetup_id='ngbwqqyzlbhb', name='Board " \
            "Meeting (Private)', location='Conference Room 2', " \
            "start_time='2019-08-05 19:00:00', end_time='2019-08-05 22:00:00', " \
            "places=['Conference Room 2']), Event(meetup_id='wjvcdryzlbhb', " \
            "name='National Space Science University (NSSU) Quantum Gravity', " \
            "location='Conference Room 2', start_time='2019-08-05 19:00:00', " \
            "end_time='2019-08-05 21:00:00', places=['Conference Room 2'])])")
    expected_conflict = Conflict(
        start_time='2019-08-05 19:00',
        end_time='2019-08-05 21:00',
        events=[
            Event(meetup_id='ngbwqqyzlbhb',
                  name='Board Meeting (Private)',
                  location='Conference Room 2',
                  start_time='2019-08-05 19:00',
                  end_time='2019-08-05 22:00',
                  places=['Conference Room 2']),
            Event(
                meetup_id='wjvcdryzlbhb',
                name='National Space Science University (NSSU) Quantum Gravity',
                location='Conference Room 2',
                start_time='2019-08-05 19:00',
                end_time='2019-08-05 21:00',
                places=['Conference Room 2'])
        ])
    assert parser.conflict() == expected_conflict
 def make_unknown_location_log_line(self, venue_name=''):
     """Return an unknown location log line object with an optional
     venue name."""
     event = Event.from_fields(UNKNOWN_LOCATION_FIELDS +
                               [('venue_name', venue_name)])
     date_time = self.date_time()
     return UnknownLocationLogLine(date_time, event)
Beispiel #3
0
def make_event(name=SAMPLE_NAME,
               location=SAMPLE_LOCATION,
               start_time=SAMPLE_START_TIME,
               end_time=SAMPLE_END_TIME,
               meetup_id=SAMPLE_MEETUP_ID):
    """Make an event with default sample values."""
    return Event(name, start_time, end_time, meetup_id, location)
 def make_schedule_conflict(self):
     """Return a schedule conflict for the conflict line."""
     return Conflict(
         start_time='2019-09-03 19:00',
         end_time='2019-09-03 21:00',
         events=[
             Event(
                 meetup_id='vzgnvqyzmbfb',
                 name=
                 'Computational Mathematics: P=NP for students and engineers at Nova Labs',
                 location='Conference Room 2',
                 start_time='2019-09-03 19:00',
                 end_time='2019-09-03 21:00',
                 places=['Conference Room 2']),
             Event(meetup_id='whkcdryzmbfb',
                   name=
                   'National Drone Science University (NDSU) Drone Science',
                   location='Conference Room 2',
                   start_time='2019-09-03 19:00',
                   end_time='2019-09-03 21:00',
                   places=['Conference Room 2'])
         ])
def test_event(log_parser_class):
    """Test recognizing an event."""
    parser = log_parser_class(
        "Event(xibo_id='430', meetup_id='zvbxrpl2', "
        "name='Nova Labs Open House', location='Orange Bay', "
        "start_time='2019-02-26 15:00:00', end_time='2019-02-26 17:00:00')")
    expected_event = Event(xibo_id='430',
                           meetup_id='zvbxrpl2',
                           name='Nova Labs Open House',
                           location='Orange Bay',
                           start_time='2019-02-26 15:00',
                           end_time='2019-02-26 17:00')
    assert parser.event() == expected_event
def test_event_list(log_parser_class):
    """Test recognizing an event list."""
    parser = log_parser_class(
        "[Event(meetup_id='lksvbqyzmbhb', name='ShopSabre CNC Open Office " \
        "Hours', location='Woodshop', start_time='2019-09-05 18:00:00', " \
        "end_time='2019-09-05 20:00:00', places=['Woodshop']), " \
        "Event(meetup_id='qbwpbryzmbhb', name='Personal Project Night in the " \
        "Woodshop', location='Woodshop', start_time='2019-09-05 19:00:00', " \
        "end_time='2019-09-05 21:00:00', places=['Woodshop'])]")
    expected_events = [
        Event(meetup_id='lksvbqyzmbhb',
              name='ShopSabre CNC Open Office Hours',
              location='Woodshop',
              start_time='2019-09-05 18:00',
              end_time='2019-09-05 20:00',
              places=['Woodshop']),
        Event(meetup_id='qbwpbryzmbhb',
              name='Personal Project Night in the Woodshop',
              location='Woodshop',
              start_time='2019-09-05 19:00',
              end_time='2019-09-05 21:00',
              places=['Woodshop'])
    ]
    assert parser.event_list() == expected_events
 def make_event_location_log_line(self, location=EVENT_LOCATION):
     """Return an event location log line object, possibly overriding the
     location."""
     event = Event.from_fields(EVENT_LOCATION_FIELDS)
     date_time = self.date_time()
     return EventLocationLogLine(date_time, location, event)
 def make_retire_log_line(self):
     """Return a retire log line object."""
     event = Event.from_fields(RETIRE_FIELDS)
     date_time = self.date_time()
     return RetireEventLogLine(date_time, event)
 def make_delete_log_line(self):
     """Return a delete log line object."""
     event = Event.from_fields(DELETE_FIELDS)
     date_time = self.date_time()
     return DeleteEventLogLine(date_time, event)
 def make_update_log_line(self):
     """Return an update log line object."""
     before_event = Event.from_fields(UPDATE_BEFORE_FIELDS)
     after_event = Event.from_fields(UPDATE_AFTER_FIELDS)
     date_time = self.date_time()
     return UpdateEventLogLine(date_time, before_event, after_event)
 def make_insert_log_line(self):
     """Return an insert log line object."""
     event = Event.from_fields(INSERT_FIELDS)
     date_time = self.date_time()
     return InsertEventLogLine(date_time, event)