def testMakeTriageStatusChangedTime(self):
        # triageStatusChange is supposed to be a GMT time in seconds (negated
        # for sorting)... prove to myself that it's really GMT.
        view = self.view
        now = datetime.datetime.now(view.tzinfo.default)
        now_tsc = Triageable.makeTriageStatusChangedTime(view)
        ny_now = now.astimezone(view.tzinfo.getInstance("America/New_York"))
        la_now = now.astimezone(view.tzinfo.getInstance("America/Los_Angeles"))

        ny_tsc = Triageable.makeTriageStatusChangedTime(view, ny_now)
        la_tsc = Triageable.makeTriageStatusChangedTime(view, la_now)
        self.failUnlessEqual(ny_tsc, la_tsc)
        self.failUnless((la_tsc - now_tsc) < 1.0)
Exemplo n.º 2
0
    def testMakeTriageStatusChangedTime(self):
        # triageStatusChange is supposed to be a GMT time in seconds (negated
        # for sorting)... prove to myself that it's really GMT.
        view = self.view
        now = datetime.datetime.now(view.tzinfo.default)
        now_tsc = Triageable.makeTriageStatusChangedTime(view)
        ny_now = now.astimezone(view.tzinfo.getInstance("America/New_York"))
        la_now = now.astimezone(view.tzinfo.getInstance("America/Los_Angeles"))

        ny_tsc = Triageable.makeTriageStatusChangedTime(view, ny_now)
        la_tsc = Triageable.makeTriageStatusChangedTime(view, la_now)
        self.failUnlessEqual(ny_tsc, la_tsc)
        self.failUnless((la_tsc - now_tsc) < 1.0)
Exemplo n.º 3
0
 def testCompleted(self):
     self.runImport(
         "BEGIN:VCALENDAR",
         "VERSION:2.0",
         "CALSCALE:GREGORIAN",
         "METHOD:PUBLISH",
         "BEGIN:VTODO",
         "DTSTART:20060213T000000",
         "SUMMARY:ToDoneAndWhen",
         "DTSTAMP:20060227T203912Z",
         "UID:DD5D311A-F73F-4619-B463-A5766A1BAE5F",
         "SEQUENCE:6",
         "STATUS:COMPLETED",
         "COMPLETED:20060301T010000Z",
         "END:VTODO",
         "END:VCALENDAR"
     )
     
     self.failUnlessEqual(1, len(self.items))
     
     item = self.items[0]
     task = pim.TaskStamp(item)
     
     self.failIf(pim.has_stamp(task, pim.TaskStamp))
     self.failUnlessEqual(task.summary, u"ToDoneAndWhen")
     self.failUnlessEqual(task.itsItem.triageStatus, pim.TriageEnum.done)
     expectedTSC = datetime.datetime(2006, 3, 1, 1, 0, 0, 0, self.utc)
     self.failUnlessEqual(task.itsItem.triageStatusChanged,
                          Triageable.makeTriageStatusChangedTime(self.view, expectedTSC))
Exemplo n.º 4
0
 def testInitialTriageState(self):        
     view = self.view
     now = datetime.datetime.now(view.tzinfo.default)
     self.failUnlessEqual(self.item.triageStatus, TriageEnum.now)
     self.failIf(hasattr(self.item, '_sectionTriageStatus'))
     self.failIf(hasattr(self.item, '_sectionTriageStatusChanged'))
     # tsc might not be exactly equal to the creation time, but it should
     # be close.
     self.failUnless(Triageable.makeTriageStatusChangedTime(view, self.item.createdOn) 
                     + self.item.triageStatusChanged < 1.0)
 def testInitialTriageState(self):
     view = self.view
     now = datetime.datetime.now(view.tzinfo.default)
     self.failUnlessEqual(self.item.triageStatus, TriageEnum.now)
     self.failIf(hasattr(self.item, '_sectionTriageStatus'))
     self.failIf(hasattr(self.item, '_sectionTriageStatusChanged'))
     # tsc might not be exactly equal to the creation time, but it should
     # be close.
     self.failUnless(
         Triageable.makeTriageStatusChangedTime(view, self.item.createdOn) +
         self.item.triageStatusChanged < 1.0)
Exemplo n.º 6
0
    def testCompleted(self):
        self.runImport("BEGIN:VCALENDAR", "VERSION:2.0", "CALSCALE:GREGORIAN",
                       "METHOD:PUBLISH", "BEGIN:VTODO",
                       "DTSTART:20060213T000000", "SUMMARY:ToDoneAndWhen",
                       "DTSTAMP:20060227T203912Z",
                       "UID:DD5D311A-F73F-4619-B463-A5766A1BAE5F",
                       "SEQUENCE:6", "STATUS:COMPLETED",
                       "COMPLETED:20060301T010000Z", "END:VTODO",
                       "END:VCALENDAR")

        self.failUnlessEqual(1, len(self.items))

        item = self.items[0]
        task = pim.TaskStamp(item)

        self.failIf(pim.has_stamp(task, pim.TaskStamp))
        self.failUnlessEqual(task.summary, u"ToDoneAndWhen")
        self.failUnlessEqual(task.itsItem.triageStatus, pim.TriageEnum.done)
        expectedTSC = datetime.datetime(2006, 3, 1, 1, 0, 0, 0, self.utc)
        self.failUnlessEqual(
            task.itsItem.triageStatusChanged,
            Triageable.makeTriageStatusChangedTime(self.view, expectedTSC))