Exemple #1
0
    def test_fastForward(self):
        """
        Test that fast forwarding to a message marks that message as read.
        """
        screen = InboxScreen(self.inbox)
        viewSelection = screen.viewSelection

        screen.fastForward(viewSelection, self.translator.toWebID(self.messages[-2]))

        # All but the second message should still be unread.
        for msg in self.messages[:-2]:
            self.failIf(msg.read, "Subsequent messages should be unread.")
        self.failIf(self.messages[-1].read, "First message should be unread.")

        # But the second should be read.
        self.failUnless(self.messages[-2], "Second message should be read.")

        # Jump to the end of the mailbox
        screen.fastForward(viewSelection, self.translator.toWebID(self.messages[0]))

        for msg in self.messages[1:-2] + self.messages[-1:]:
            self.failIf(msg.read, "Middle messages should be unread.")

        for msg in self.messages[:1] + [self.messages[-2]]:
            self.failUnless(msg.read, "Second and final messages should be read.")
 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 widgetFor(self, inbox):
     """
     Create and return an InboxScreen for the given inbox.
     """
     fragment = InboxScreen(inbox)
     fragment.messageDetailFragmentFactory = ActionlessMsgDetailWithStubCompose
     fragment.setFragmentParent(self)
     return fragment
def main():
    inbox = createInboxWithManyMessages()
    screen = InboxScreen(inbox)

    start()
    for i in xrange(N_LOOKUPS):
        for v in VIEWS:
            screen.changeView(v)
            screen.getFirstMessage()
    stop()
Exemple #5
0
    def test_inboxComposeFragmentRendering(self):
        """
        Test rendering of the L{xquotient.compose.ComposeFragment} returned
        from L{xquotient.inbox.InboxScreen.getComposer}
        """
        installOn(compose.Composer(store=self.substore), self.substore)

        inbox = self.substore.findUnique(Inbox)
        inboxScreen = InboxScreen(inbox)

        composeFrag = inboxScreen.getComposer()

        return renderLivePage(ThemedFragmentWrapper(composeFrag))
    def test_inboxComposeFragmentRendering(self):
        """
        Test rendering of the L{xquotient.compose.ComposeFragment} returned
        from L{xquotient.inbox.InboxScreen.getComposer}
        """
        installOn(compose.Composer(store=self.substore), self.substore)

        inbox = self.substore.findUnique(Inbox)
        inboxScreen = InboxScreen(inbox)

        composeFrag = inboxScreen.getComposer()

        return renderLivePage(
            ThemedFragmentWrapper(composeFrag))
 def setUp(self):
     self.store = Store()
     self.scheduler = IScheduler(self.store)
     self.inbox = Inbox(store=self.store)
     installOn(self.inbox, self.store)
     self.translator = self.inbox.privateApplication
     self.inboxScreen = InboxScreen(self.inbox)
     self.viewSelection = dict(self.inboxScreen.viewSelection)
def main():
    inbox = createInboxWithManyMessages()
    screen = InboxScreen(inbox)

    when = screen.getMessageAfter(screen.getFirstMessage())

    start()
    for i in xrange(N_LOOKUPS):
        for v in VIEWS:
            screen.changeView(v)
            screen.getMessageBefore(when)
    stop()
    def test_fastForward(self):
        """
        Test that fast forwarding to a message marks that message as read.
        """
        screen = InboxScreen(self.inbox)
        viewSelection = screen.viewSelection

        screen.fastForward(viewSelection,
                           self.translator.toWebID(self.messages[-2]))

        # All but the second message should still be unread.
        for msg in self.messages[:-2]:
            self.failIf(msg.read, "Subsequent messages should be unread.")
        self.failIf(self.messages[-1].read, "First message should be unread.")

        # But the second should be read.
        self.failUnless(self.messages[-2], "Second message should be read.")

        # Jump to the end of the mailbox
        screen.fastForward(viewSelection,
                           self.translator.toWebID(self.messages[0]))

        for msg in self.messages[1:-2] + self.messages[-1:]:
            self.failIf(msg.read, "Middle messages should be unread.")

        for msg in self.messages[:1] + [self.messages[-2]]:
            self.failUnless(msg.read,
                            "Second and final messages should be read.")
def main():
    inbox = createInboxWithManyMessages()
    screen = InboxScreen(inbox)

    when = screen.getMessageBefore(screen.getLastMessage())

    start()
    for i in xrange(N_LOOKUPS):
        for v in VIEWS:
            screen.changeView(v)
            screen.getMessageAfter(when)
    stop()
Exemple #11
0
def main():
    inbox = createInboxWithManyMessages()
    screen = InboxScreen(inbox)

    start()
    for i in xrange(N_LOOKUPS):
        for v in VIEWS:
            screen.changeView(v)
            screen.getLastMessage()
    stop()
Exemple #12
0
    def test_inboxRendering(self):
        """
        Test rendering of the inbox with a handful of extremely complex
        messages in it.
        """
        def deliverMessages():
            for i in xrange(5):
                makeMessage(self.createMIMEReceiver(),
                            self.aBunchOfRelatedParts, None)

        self.substore.transact(deliverMessages)

        inbox = self.substore.findUnique(Inbox)

        composer = compose.Composer(store=self.substore)
        installOn(composer, self.substore)

        return renderLivePage(ThemedFragmentWrapper(InboxScreen(inbox)))
    def test_screenCreation(self):
        """
        Test that creating the view for an inbox marks the first message in
        that mailbox as read.

        XXX - Uhhh, is this actually the desired behavior?  It seems kind of
        broken. -exarkun
        """

        # Make sure things start out in the state we expect
        for msg in self.messages:
            self.failIf(msg.read, "Messages should start unread.")

        screen = InboxScreen(self.inbox)

        # All but the first message should still be unread
        for msg in self.messages:
            self.failIf(
                msg.read,
                "Messages should all be unread after inbox rendering.")
    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)