def test_CommandsReflect(self): kontext = Kontext() kontext['REFERER'] = 'From a UNIT TEST' c = Command("CommandsReflect") c.addParameter("panel",u"west") it = Itinerary(kontext) it.addInCommand(c) it = fwk().processItinerary(it) retJSON = fwk().CommandsToJSON(it.outCommands,it.kontext) print retJSON
def test_Ping(self): kontext = Kontext() kontext['REFERER'] = 'From a UNIT TEST' c = Command("Ping") c.addParameter("name",u"echo") c.addParameter("age",44) it = Itinerary(kontext) it.addInCommand(c) it = fwk().processItinerary(it) retJSON = fwk().CommandsToJSON(it.outCommands,it.kontext) print retJSON
def test_CallingPing(self): name = "bunny" c = Command("Ping") c.addParameter("name",name) kontext = Kontext() kontext.setKeyValue("user", "grant") itinerary = Itinerary(kontext) itinerary.addInCommand(c) re = fwk().processItinerary(itinerary) self.assertEquals(re.outCommands[0].name,"ReturnCommand") self.assertEquals(re.outCommands[0].params[0].name,"echo") self.assertEquals(re.outCommands[0].params[0].val,name)
def test_ShowToc(self): kontext = Kontext() kontext['REFERER'] = 'From a UNIT TEST' c = Command("ShowToc") c.addParameter("panel",u"west") c.addParameter("what","admin") c.addParameter("orientation","vertical") it = Itinerary(kontext) it.addInCommand(c) it = fwk().processItinerary(it) retJSON = fwk().CommandsToJSON(it.outCommands,it.kontext) print retJSON