Planta_Test API Reference

Information

  • The package "planta_test" provides additional functionality EXCLUSIVELY for regtests
  • No Python functions of this package must ever be called by customizing outside of testing functionality!

Macro example

This example calls an insert event on a specific record (target)

   from planta_test import planta_test
   from planta_test import xml_strings

   module = ppms.get_focused_module()
   cmdstart = '<Cmd type="MenuItemActivation" id="11"><InsertChildWithDAC>'
   target = submodule.get_root(0).get_record_by_dac_id("040833", 0).get_children_by_dac_id("044473")[0].get_children_by_dac_id("040270")[2]
   cust = submodule.get_customizing().get_dac_by_id('040272')
   cmdend = '</InsertChildWithDAC><CurrentDACHasFocus value="true" /></Cmd>'

   xml_string = xml_strings.build_client_string(module, start_cmd=cmdstart, active_target=target, customizing=cust, end_cmd=cmdend)
   planta_test.call_event(xml_string)

General Functions of planta_test

Method Parameter Return value Comment
call_garbage_collection()     Calls the garbage collection for server objects (e.g. records, dis...). This deletes these objects if system thinks too many of them are not used anymore
force_garbage_collection()     Forces the garbage collection of any object (e.g. record, di...) the system thinks is not used anymore, no matter how many unused objects there are
call_event(xml_string, call_now = 1) xml_string: String defining an event the Client would send to the Server

call_now: optional parameter int/bool: If True (standard value), this event is run immediately. If False, it is queued like any other event, so that it can be found later

True if the event could be handled successfully, False if an Error occured Executes this simulated event exactly like a real Client event

Submodule XML_strings.py

This module provides the building of XML strings for Client events.

Method Parameters Return Value Comment
build_client_string(module, header = '<?xml version="1.0" encoding="utf-8"?><Message>', start_cmd = '<Cmd type="MenuItemActivation" id="12">', active_target = None, customizing = None, end_cmd = '</Cmd>', closure = '</Module></Panel></Message>') module: The Module of this Event

header: String for the XML's header; should usually not be changed

start_cmd: string identifying the type of this message. Usually, this is the cmd type of an XML string

active_target: The object to which this event refers to. Can either be a Root, a Record or a Datafield. If not None, this creates a complete structure under start_cmd

customizing: The customizing object to which this event refers to. Can either be a RootC, a DAC or a DFC. If not None, this puts the complete path to the Customizing object under the (or start_cmd if no active target was set)

end_cmd: string terminating the cmd type. Should only be set if the XML event does more than just print the cmd closing tag

closure: final terminater of the XML string. Like header, this should usually not be changed.

An XML-type string for call_event  

         PLANTA project









 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten
This site is powered by the TWiki collaboration platform Powered by Perl