コード例 #1
0
    def test_update_event(self):
        ical1 = loadCal("test_data/01-01_NewSingleEvent.ics")
        del ical1["METHOD"]
        ical2 = loadCal("test_data/01-02_SingleEventUpdateTime.ics")

        ical_result = ical_tools.merge(ical1, ical2)
        del ical2["METHOD"]
        self.assertEqual(ical2.to_ical(), ical_result.to_ical())

        ical3 = loadCal("test_data/01-03_SingleEventUpdateLocation.ics")
        ical_result = ical_tools.merge(ical2, ical3)
        del ical3["METHOD"]
        self.assertEqual(ical3.to_ical(), ical_result.to_ical())
コード例 #2
0
    def test_sequence_changed(self):
        cal_init = loadCal("test_data/02-03-Result.ics")
        cal_update1 = loadCal(
            "test_data/02-05-RepeatingEventUpdateSingleSummary.ics")
        cal_update2 = loadCal(
            "test_data/02-04-RepeatingEventUpdateSingleLocation.ics")
        cal_expected = loadCal("test_data/02-05-Result.ics")

        cal_result = ical_tools.merge(cal_init, cal_update1)
        cal_result = ical_tools.merge(cal_result, cal_update2)

        self.maxDiff = None
        self.assertEqual(cal_expected.to_ical().decode("utf-8"),
                         cal_result.to_ical().decode("utf-8"))
コード例 #3
0
    def test_cancel_event(self):
        ical1 = loadCal("test_data/01-03_SingleEventUpdateLocation.ics")
        del ical1["METHOD"]
        ical2 = loadCal("test_data/01-04_SingleEventCancel.ics")

        ical_result = ical_tools.merge(ical1, ical2)
        self.assertEqual(None, ical_result)
コード例 #4
0
 def test_new_event(self):
     ical = loadCal("test_data/01-01_NewSingleEvent.ics")
     ical_result = ical_tools.merge(None, ical)
     del ical["METHOD"]
     self.maxDiff = None
     self.assertEqual(ical.to_ical().decode("utf-8"),
                      ical_result.to_ical().decode("utf-8"))
コード例 #5
0
    def test_new_event(self):
        cal_init = None
        cal_update = loadCal("test_data/02-01-NewRepeatingEvent.ics")
        cal_expected = loadCal("test_data/02-01-Result.ics")

        cal_result = ical_tools.merge(cal_init, cal_update)
        self.assertEqual(cal_expected.to_ical().decode("utf-8"),
                         cal_result.to_ical().decode("utf-8"))
コード例 #6
0
    def test_cancel_whole_event(self):
        cal_init = loadCal("test_data/02-09-Result.ics")
        cal_update = loadCal("test_data/02-10-RepeatingEventCancel.ics")
        cal_expected = loadCal("test_data/02-10-Result.ics")

        cal_result = ical_tools.merge(cal_init, cal_update)
        self.maxDiff = None
        self.assertIsNone(cal_result)
コード例 #7
0
    def test_cancel_single_event(self):
        cal_init = loadCal("test_data/02-02-Result.ics")
        cal_update = loadCal("test_data/02-03-RepeatingEventCancelSingle.ics")
        cal_expected = loadCal("test_data/02-03-Result.ics")

        cal_result = ical_tools.merge(cal_init, cal_update)
        self.maxDiff = None
        self.assertEqual(cal_expected.to_ical().decode("utf-8"),
                         cal_result.to_ical().decode("utf-8"))
コード例 #8
0
    def test_update_summary_single_event2(self):
        cal_init = loadCal("test_data/02-06-Result.ics")
        cal_update = loadCal(
            "test_data/02-07-RepeatingEventUpdateSingleSummary.ics")
        cal_expected = loadCal("test_data/02-07-Result.ics")

        cal_result = ical_tools.merge(cal_init, cal_update)
        self.maxDiff = None
        self.assertEqual(cal_expected.to_ical().decode("utf-8"),
                         cal_result.to_ical().decode("utf-8"))
コード例 #9
0
    def test_remove_nonexisting_single_event(self):
        cal_init = None
        cal_update = loadCal("test_data/02-03-RepeatingEventCancelSingle.ics")

        cal_result = ical_tools.merge(cal_init, cal_update)
        self.assertIsNone(cal_result)