コード例 #1
0
 def objectify(self, xmlString):
     """
   @summary: Takes an XML string and processes it into a python object
   @param xmlString: The xml string to turn into an object
   @note: Uses LmAttList and LmAttObj
   @note: Object attributes are defined on the fly
   """
     return deserialize(fromstring(xmlString))
コード例 #2
0
 def objectify(self, xmlString):
    """
    @summary: Takes an XML string and processes it into a python object
    @param xmlString: The xml string to turn into an object
    @note: Uses LmAttList and LmAttObj
    @note: Object attributes are defined on the fly
    """
    return deserialize(fromstring(xmlString))   
コード例 #3
0
   def validate(self, xmlContent, lmSchema):
      """
      @summary: Validates XML content against a response schema
      @param xmlContent: XML content as a string to validate
      @param lmSchema: An object representing a response schema to test against
      @raise InvalidResponseException: Raised if the response does not match
                                          the schema
      @return: True if the response is valid
      """
      xmlObj = deserialize(fromstring(xmlContent))
      
      processFn = self._getProcessFn(lmSchema)
      processFn(xmlObj, lmSchema)

      return True
コード例 #4
0
 pwd = args.pwd
 
 env = LmServerEnv(userId=userId)
 # Arguments that we can use
 # user
 # password
 # server (optional)
 # env type
 # client file or directory
 
 publicOpener, authOpener = getOpeners(env, userId, pwd)
 # For each client
 for fn in glob.iglob(os.path.join(CLIENTS_DIR, "*")):
    with open(fn, 'r') as inF:
       schemaCnt = inF.read()
    lmSchema = deserialize(fromstring(schemaCnt))
    print "Checking %s, version %s" % (lmSchema.name, lmSchema.version)
    reqs = lmSchema.Request
    if not isinstance(reqs, list):
       reqs = [reqs]
    for req in reqs:
       try:
          print " ---", req.description
       except:
          print " --- %s %s" % (req.method, req.url)
       url = req.url
       method = req.method
       creds = req.credentials
       
       try:
          rs = req.replaceString