class _ControllerMixin: aliceEmail = u'*****@*****.**' bobEmail = u'*****@*****.**' tzfactor = time.daylight and time.altzone or time.timezone sent = Time.fromDatetime(datetime(1999, 12, 13)) sent2 = Time().oneDay() + timedelta(hours=16, minutes=5, seconds=tzfactor) def getInbox(self): """ Return a newly created Inbox, in a newly created Store. """ s = Store() LoginMethod(store=s, internal=False, protocol=u'email', localpart=u'default', domain=u'host', verified=True, account=s) installOn(Composer(store=s), s) installOn(Catalog(store=s), s) installOn(MessageLister(store=s), s) inbox = Inbox(store=s) installOn(inbox, s) return inbox def widgetFor(self, inbox): """ Create and return an InboxScreen for the given inbox. """ fragment = InboxScreen(inbox) fragment.messageDetailFragmentFactory = ActionlessMsgDetailWithStubCompose fragment.setFragmentParent(self) return fragment
def test_getValue(self): """ L{methanal.view.DateInput.getValue} retrieves an empty string in the C{None} case and a string representing the C{Time} specified by parameter's value, in the case where a value exists. """ control = self.createControl(dict(timezone=FixedOffset(0, 0))) param = control.parent.param param.value = None self.assertEquals(control.getValue(), u'') param.value = Time.fromDatetime(datetime(2007, 1, 1)) self.assertTrue(isinstance(control.getValue(), unicode)) self.assertEquals(control.getValue(), u'2007-01-01') param.value = Time.fromDatetime(datetime(542, 12, 18)) self.assertEquals(control.getValue(), u'0542-12-18')
def test_getValue(self): """ L{methanal.view.DateInput.getValue} retrieves an empty string in the C{None} case and a string representing the C{Time} specified by parameter's value, in the case where a value exists. """ control = self.createControl(dict(timezone=FixedOffset(0, 0))) param = control.parent.param param.value = None self.assertEquals(control.getValue(), u"") param.value = Time.fromDatetime(datetime(2007, 1, 1)) self.assertTrue(isinstance(control.getValue(), unicode)) self.assertEquals(control.getValue(), u"2007-01-01") param.value = Time.fromDatetime(datetime(542, 12, 18)) self.assertEquals(control.getValue(), u"0542-12-18")
def setUp(self): """ Create a handful of messages spread out over a brief time period so that tests can assert things about methods which operate on messages. """ self.store = Store() inboxItem = Inbox(store=self.store) installOn(inboxItem, self.store) self.privateApplication = inboxItem.privateApplication self.webTranslator = IWebTranslator(self.store) baseTime = datetime(year=2001, month=3, day=6) self.msgs = [] for i in xrange(5): self.msgs.append( testMessageFactory(store=self.store, read=False, spam=False, receivedWhen=Time.fromDatetime( baseTime + timedelta(seconds=i)))) self.inbox = InboxScreen(inboxItem)
def setUp(self): """ Create a handful of messages spread out over a brief time period so that tests can assert things about methods which operate on messages. """ self.store = Store() inboxItem = Inbox(store=self.store) installOn(inboxItem, self.store) self.privateApplication = inboxItem.privateApplication self.webTranslator = IWebTranslator(self.store) baseTime = datetime(year=2001, month=3, day=6) self.msgs = [] for i in xrange(5): self.msgs.append( testMessageFactory( store=self.store, read=False, spam=False, receivedWhen=Time.fromDatetime(baseTime + timedelta(seconds=i)))) self.inbox = InboxScreen(inboxItem)
def parse(timeString): return Time.fromDatetime(_parse(timeString))
def getTimestamp(self): return Time.fromDatetime(datetime.now().replace( hour=0, minute=0, second=0)).asPOSIXTimestamp()
def getTimestamp(self): return Time.fromDatetime(datetime.now().replace(hour=0, minute=0, second=0) ).asPOSIXTimestamp()