Beispiel #1
0
    def test_makePSNode_okName(self):
        name = 'ok name'
        self.psclient.createNode = Mock(side_effect=utils.good_side_effect('lush'))        

        d = sm.makePSNode(self.sender, name, self.psclient)

        def cb(msg):
            self.assertEquals(msg, name)
            self.assertEquals(self.psclient.createNode.call_count, 1)

        d.addCallback(cb)
        return d
Beispiel #2
0
    def test_makePSNode_badName(self):
        name = 'bad name'
        self.psclient.createNode = Mock(side_effect=utils.bad_side_effect(error.StanzaError(
            condition='conflict', text='%s: not lush' % self.__class__)))        

        d = sm.makePSNode(self.sender, name, self.psclient, 3)

        def cb(msg):
            self.assertTrue(False)
            
        def eb(msg):
            self.assertNotEquals(msg, name)
            self.assertEquals(self.psclient.createNode.call_count, 3)

        d.addCallbacks(cb, eb)
        return d