Beispiel #1
0
 def jsonEqual(self, expectedValue, actualValue, msg, isAddEqInfo=False, ignoreKey=None):
     if ignoreKey is None:
         cmpRes, cmpInfo = ObjOperation.jsonEqual(expectedValue, actualValue, isAddEqInfo)
     else:
         def isCmp(key, keyPath):
             return not ignoreKey.__contains__(key)
         cmpRes, cmpInfo = ObjOperation.jsonEqual(expectedValue, actualValue, isAddEqInfo, isCmpHandler=isCmp)
     if cmpRes % 1000 != 0:
         raise TestCheck(MTConst.jsonContainInfo % ("NOT ", msg, cmpInfo))
     self.tlog.success(MTConst.jsonContainInfo % ("", msg, cmpInfo))
Beispiel #2
0
    def executeInfTest(self,
                       hostPort,
                       infName,
                       dataIndex,
                       inProp="",
                       outProp="",
                       replaceProp=None,
                       isDirectReturn=False):
        infCase = self.__getInfData__(infName)[int(dataIndex)]
        infRet = self.doInfRequest(hostPort, infName, infCase['a'],
                                   replaceProp)

        if str(isDirectReturn).lower() == "true":
            return infRet

        try:
            resp = ObjOperation.jsonEqual(
                toJsonObj(infCase['d']),
                infRet,
                isAddEqInfo=True,
                isCmpHandler=lambda key, keyPath: self.__isNeedCheck__(
                    key, keyPath, inProp, outProp))
        except:
            if infCase['d'] == infRet:
                resp = [0, str(infRet)]
            else:
                resp = [1, str(infRet)]

        return list(resp)
Beispiel #3
0
 def diffUrlParam(self, urlParam, urlParam2, tupeKey="goodsInfoArray"):
     p1 = self.urlParamToJson(urlParam, tupeKey)
     p2 = self.urlParamToJson(urlParam2, tupeKey)
     resp = "%s%s" % ObjOperation.jsonEqual(p1, p2)
     return resp
Beispiel #4
0
 def diffJson(self, jsonStr, jsonStr2):
     return "%s\n%s" % ObjOperation.jsonEqual(
         TValueGroup(jsonStr).__prop__,
         TValueGroup(jsonStr2).__prop__)