def test_getDiscoItems_badNodeID(self): csm = CollabSystemManager(self.testJid) csm.menu.getChildItems = Mock(side_effect=KeyError) actual = csm.getDiscoItems(jid.JID('*****@*****.**'), self.testJid, 'the node') self.assertEquals(actual, []) csm.menu.getChildItems.assert_called_with('the node')
def test_getDiscoItems_withNodeID(self): csm = CollabSystemManager(self.testJid) items = ['item1', 'item2'] csm.menu.getChildItems = Mock(return_value=items) actual = csm.getDiscoItems(jid.JID('*****@*****.**'), self.testJid, 'the node') self.assertEquals(actual, items) csm.menu.getChildItems.assert_called_with('the node')
def test_getDiscoItems_badTarget(self): csm = CollabSystemManager(self.testJid) items = csm.getDiscoItems(jid.JID('*****@*****.**'), jid.JID('*****@*****.**')) self.assertEquals(items, [])