Beispiel #1
0
    def test_parse_iq(self):
        dct1 = dict({'one': 1})
        self.stateMngr.penultimateState = Mock(return_value=dct1)
        prev = PrevHandler('nodeTest', self.stateMngr, self.pageMngr)
        dct2 = prev._parse_iq(self.iq)

        self.assertTrue(self.stateMngr.penultimateState.called)
        self.assertEquals(dct2, dct1)
Beispiel #2
0
    def test_manage_state(self):
        self.stateMngr.push = Mock()
        s1 = dict()
        self.stateMngr.head = Mock(return_value=s1)
        prev = PrevHandler('nodeTest', self.stateMngr, self.pageMngr)
        s2 = dict()
        s3 = prev._manage_state(s2)

        self.stateMngr.push.assert_called_once_with(s2)
        self.assertEquals(s3, s1)
Beispiel #3
0
    def test_make_next_iq(self):
        self.pageMngr.prev_page = Mock(side_effect=utils.good_side_effect(iq()))
        prev = PrevHandler('nodeTest', self.stateMngr, self.pageMngr)
        iq1 = self.iq
        d_iq2 = prev._make_next_iq(iq1, None)

        def checkIt(iq2):
            self.assertTrue(self.pageMngr.prev_page.called)
            self.assertEquals(iq2.toXml(), iq().toXml())

        d_iq2.addCallback(checkIt)
        return d_iq2
Beispiel #4
0
 def test_can_process(self):
     prev = PrevHandler('nodeTest', self.stateMngr, self.pageMngr)
     iq = self.iq
     cmd = Command(node='nodeTest', action='prev')
     iq.addChild(cmd.toElement())
     self.assertTrue(prev.can_process(iq))
Beispiel #5
0
 def test_can_process_nocmd(self):
     prev = PrevHandler('nodeTest', self.stateMngr, self.pageMngr)
     self.assertFalse(prev.can_process(self.iq))