Example #1
0
    def test_PageManager_next_page_badIndex(self):

        mngr = PageManager()
        mngr.add_page(CommandPage(self.cmd))
        mngr.index = 1
        try:
            yield mngr.next_page(self.next_iq, self.state)
        except PageManagerError as e:
            pass
Example #2
0
    def test_PageManager_ready(self):

        mngr = PageManager()
        mngr.add_page(CommandPage(self.cmd))
        mngr.index = 0
        self.assertFalse(mngr.ready())

        iq = yield mngr.next_page(self.next_start_iq, self.state)

        self.assertTrue(mngr.ready())
Example #3
0
    def test_PageManager_next_page_start(self):

        mngr = PageManager()
        mngr.add_page(CommandPage(self.cmd))
        mngr.index = 0
        iq = yield mngr.next_page(self.next_start_iq, self.state)

        self.assertEquals(mngr.index, 1)

        self.assertEquals(iq["to"], "*****@*****.**")
        self.assertEquals(iq["from"], "*****@*****.**")
        self.assertEquals(iq["id"], "id1")
        self.assertEquals(iq["type"], "result")

        cmd = iq.firstChildElement()
        self.assertEquals(cmd.toXml(), self.cmd.toElement().toXml())
Example #4
0
 def test_PageManager_add_page(self):
     mngr = PageManager()
     p = CommandPage(self.cmd)
     mngr.add_page(p)
     self.assertEquals(len(mngr.pages), 1)
     self.assertEquals(mngr.pages[0], p)