Exemplo n.º 1
0
 def should_be_conflicting(self, yaml1, yaml2):
     """Exception is raised when meetings should conflict."""
     meeting_one = meeting.load_meetings(yaml1)
     meeting_two = meeting.load_meetings(yaml2)
     meeting_list = [meeting_one.pop(), meeting_two.pop()]
     self.assertRaises(meeting.MeetingConflictError,
                       meeting.check_for_meeting_conflicts,
                       meeting_list)
Exemplo n.º 2
0
def main():
    args = parse_args()

    yaml_dir = os.path.abspath(args.yaml_dir)
    _check_if_location_exists(yaml_dir, style='d')

    meetings = meeting.load_meetings(yaml_dir)
    # Check uniqueness and conflicts here before writing out to .ics
    meeting.check_for_meeting_conflicts(meetings)

    if args.ical_dir:
        ical_dir = _prepare_output(args.ical_dir, style='d', force=args.force)
        ical.convert_meetings_to_ical(meetings, outputdir=ical_dir)
    else:
        icalfile = _prepare_output(args.icalfile, force=args.force)
        ical.convert_meetings_to_ical(meetings, outputfile=icalfile,
                                      caldescription=args.caldescription,
                                      calname=args.calname)

    if args.index_template and args.index_output:
        index_template = os.path.abspath(args.index_template)
        _check_if_location_exists(index_template)
        index_output = _prepare_output(args.index_output, force=args.force)
        index.convert_meetings_to_index(
            meetings, index_template, index_output)
Exemplo n.º 3
0
def main():
    # build option parser:
    description = """
A tool that checks a meeting chair matches the canonical format.
"""

    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description=description)

    parser.add_argument("-y", "--yamldir",
                        dest="yaml_dir",
                        required=True,
                        help="directory containing YAML to process")

    args = parser.parse_args()
    meetings = meeting.load_meetings(args.yaml_dir)
    return_code = 0
    for m in meetings:
            ok, msg = check_chair(m.chair)
            if not ok:
                return_code = 1
                print(m.filefrom)
                print(msg.rstrip())
    return return_code
Exemplo n.º 4
0
 def test_skip_meeting(self):
     meeting_yaml = sample_data.MEETING_WITH_SKIP_DATES
     # Copied from sample_data.MEETING_WITH_SKIP_DATES
     summary = 'OpenStack Subteam 8 Meeting'
     patterns = []
     # The "main" meeting should have an exdate
     patterns.append(re.compile('.*exdate:\s*20150810T120000', re.I))
     # The "main" meeting should start on 2015-08-13
     patterns.append(re.compile('.*dtstart;.*:20150803T120000Z', re.I))
     # The "main" meeting should have a simple summary
     patterns.append(re.compile('.*summary:\s*%s' % summary, re.I))
     # The "skipped" meeting should start on 20150806
     patterns.append(re.compile('.*dtstart;.*:20150810T120000Z', re.I))
     # The "skipped" meeting should say include 'CANCELLED' and the datetime
     patterns.append(re.compile('.*summary:\s*CANCELLED.*20150810T120000Z',
                                re.I))
     m = meeting.load_meetings(meeting_yaml)[0]
     cal = ical.Yaml2IcalCalendar()
     cal.add_meeting(m)
     cal_str = str(cal.to_ical())
     self.assertTrue(hasattr(m.schedules[0], 'skip_dates'))
     for p in patterns:
         self.assertNotEqual(None, p.match(cal_str))
Exemplo n.º 5
0
 def test_adhoc_meeting(self):
     meeting_yaml = sample_data.ADHOC_MEETING
     m = meeting.load_meetings(meeting_yaml)[0]
     cal = ical.Yaml2IcalCalendar()
     cal.add_meeting(m)
     self.assertEqual(cal, ical.Yaml2IcalCalendar())
 def test_next_meeting_start_date(self):
     m = meeting.load_meetings(sample_data.MEETING_WITH_START_DATE)[0]
     self.assertEqual(
         datetime.datetime(2015, 8, 6, 0, 0),
         recurrence.WeeklyRecurrence().next_occurence(
             m.schedules[0].start_date, m.schedules[0].day))
Exemplo n.º 7
0
 def should_not_conflict(self, yaml1, yaml2):
     """No exception raised when meetings shouldn't conflict."""
     meeting_one = meeting.load_meetings(yaml1)
     meeting_two = meeting.load_meetings(yaml2)
     meeting_list = [meeting_one.pop(), meeting_two.pop()]
     meeting.check_for_meeting_conflicts(meeting_list)
Exemplo n.º 8
0
 def test_load_yaml_file(self):
     m = meeting.load_meetings(sample_data.WEEKLY_MEETING)[0]
     self.assertEqual('OpenStack Subteam Meeting', m.project)
     self.assertEqual('Joe Developer', m.chair)
     self.assertEqual('Weekly meeting for Subteam project.\n',
                      m.description)
Exemplo n.º 9
0
 def test_adhoc_meeting(self):
     meeting_yaml = sample_data.ADHOC_MEETING
     m = meeting.load_meetings(meeting_yaml)[0]
     cal = ical.Yaml2IcalCalendar()
     cal.add_meeting(m)
     self.assertEqual(cal, ical.Yaml2IcalCalendar())
Exemplo n.º 10
0
 def test_meeting_duration(self):
     m = meeting.load_meetings(sample_data.MEETING_WITH_DURATION)[0]
     self.assertEqual(30, m.schedules[0].duration)
     m = meeting.load_meetings(sample_data.WEEKLY_MEETING)[0]
     self.assertEqual(60, m.schedules[0].duration)
Exemplo n.º 11
0
 def test_next_meeting_start_date(self):
     m = meeting.load_meetings(sample_data.MEETING_WITH_START_DATE)[0]
     self.assertEqual(
         datetime.datetime(2015, 8, 6, 0, 0),
         recurrence.WeeklyRecurrence().next_occurence(
             m.schedules[0].start_date, m.schedules[0].day))