Пример #1
0
 def test_agenda_fail(self, coll_vdirs):
     with freeze_time('2016-04-10 12:33'):
         coll, vdirs = coll_vdirs
         with pytest.raises(exceptions.FatalError):
             khal_list(coll, conf=conf, agenda_format=event_format, datepoint=['xyz'])
         with pytest.raises(exceptions.FatalError):
             khal_list(coll, conf=conf, agenda_format=event_format, datepoint=['today'])
Пример #2
0
 def test_agenda_fail(self, coll_vdirs):
     with freeze_time('2016-04-10 12:33'):
         coll, vdirs = coll_vdirs
         with pytest.raises(exceptions.FatalError):
             khal_list(coll, conf=conf, agenda_format=event_format, datepoint=['xyz'])
         with pytest.raises(exceptions.FatalError):
             khal_list(coll, conf=conf, agenda_format=event_format, datepoint=['today'])
Пример #3
0
 def test_new_event_day_format(self, coll_vdirs):
     coll, vdirs = coll_vdirs
     event = coll.new_event(event_today, utils.cal1)
     coll.new(event)
     assert ['Today\x1b[0m',
             '                 a meeting :: short description\x1b[0m'] == \
         khal_list(coll, [], conf, agenda_format=event_format, day_format="{name}")
Пример #4
0
 def test_new_event_day_format(self, coll_vdirs):
     coll, vdirs = coll_vdirs
     event = coll.new_event(event_today, utils.cal1)
     coll.new(event)
     assert ['Today\x1b[0m',
             '                 a meeting :: short description\x1b[0m'] == \
         khal_list(coll, [], conf, agenda_format=event_format, day_format="{name}")
Пример #5
0
 def test_agenda_default_day_format(self, coll_vdirs):
     with freeze_time('2016-04-10 12:33'):
         today = dt.date.today()
         event_today = event_allday_template.format(
             today.strftime('%Y%m%d'), tomorrow.strftime('%Y%m%d'))
         coll, vdirs = coll_vdirs
         event = coll.new_event(event_today, utils.cal1)
         coll.new(event)
         out = khal_list(
             coll, conf=conf, agenda_format=event_format, datepoint=[])
         assert [
             '\x1b[1m10.04.2016 12:33\x1b[0m\x1b[0m',
             '↦                a meeting :: short description\x1b[0m'] == out
Пример #6
0
 def test_agenda_default_day_format(self, coll_vdirs):
     with freeze_time('2016-04-10 12:33'):
         today = dt.date.today()
         event_today = event_allday_template.format(
             today.strftime('%Y%m%d'), tomorrow.strftime('%Y%m%d'))
         coll, vdirs = coll_vdirs
         event = coll.new_event(event_today, utils.cal1)
         coll.new(event)
         out = khal_list(
             coll, conf=conf, agenda_format=event_format, datepoint=[])
         assert [
             '\x1b[1m10.04.2016 12:33\x1b[0m\x1b[0m',
             '↦                a meeting :: short description\x1b[0m'] == out
Пример #7
0
    def khal_calendar(self):
        self._init_config()
        daterange = (str(datetime.now().strftime(self.datetimeformat)) + " " +
                     self.date_end)
        output = khal_list(self.collection, daterange, self.config,
                           self.output_format)
        output = list(map(lambda x: self._format_output(x), output[1:]))

        output = " ".join(output)
        khal_data = {"appointments": output}
        return {
            "full_text": self.py3.safe_format(self.format, khal_data),
            "cached_until": self.py3.time_in(self.cache_timeout),
        }
Пример #8
0
    def khal_calendar(self):
        self._init_config()
        daterange = (
            str(datetime.now().strftime(self.datetimeformat)) + " " + self.date_end
        )
        output = khal_list(self.collection, daterange, self.config, self.output_format)
        output = list(map(lambda x: self._format_output(x), output[1:]))

        output = " ".join(output)
        khal_data = {"appointments": output}
        return {
            "full_text": self.py3.safe_format(self.format, khal_data),
            "cached_until": self.py3.time_in(self.cache_timeout),
        }
Пример #9
0
 def test_empty_recurrence(self, coll_vdirs):
     coll, vidrs = coll_vdirs
     coll.new(coll.new_event(dedent(
         'BEGIN:VEVENT\r\n'
         'UID:no_recurrences\r\n'
         'SUMMARY:No recurrences\r\n'
         'RRULE:FREQ=DAILY;COUNT=2;INTERVAL=1\r\n'
         'EXDATE:20110908T130000\r\n'
         'EXDATE:20110909T130000\r\n'
         'DTSTART:20110908T130000\r\n'
         'DTEND:20110908T170000\r\n'
         'END:VEVENT\r\n'
     ), utils.cal1))
     assert 'no events' in '\n'.join(
         khal_list(coll, [], conf, agenda_format=event_format, day_format="{name}")).lower()
Пример #10
0
 def test_empty_recurrence(self, coll_vdirs):
     coll, vidrs = coll_vdirs
     coll.new(coll.new_event(dedent(
         'BEGIN:VEVENT\r\n'
         'UID:no_recurrences\r\n'
         'SUMMARY:No recurrences\r\n'
         'RRULE:FREQ=DAILY;COUNT=2;INTERVAL=1\r\n'
         'EXDATE:20110908T130000\r\n'
         'EXDATE:20110909T130000\r\n'
         'DTSTART:20110908T130000\r\n'
         'DTEND:20110908T170000\r\n'
         'END:VEVENT\r\n'
     ), utils.cal1))
     assert 'no events' in '\n'.join(
         khal_list(coll, [], conf, agenda_format=event_format, day_format="{name}")).lower()