Esempio n. 1
0
 def saveExpectation(self, expectationDict, group, APIShortName):
     '''
     Currently, we save these expectation into file with json format. In the future, we will move them into Redis or memcache 
     '''
     workingPath=self.getWorkingPath(group, APIShortName)
     expectationFile=self.getExpectationPath(workingPath)
     fileHandler=FileWrapper(expectationFile)
     return fileHandler.saveDictAsJsonFile(expectationDict)
Esempio n. 2
0
    def loadExpectation(self, requestDict, group, APIShortName):
        '''
        Currently, these expectation were save into file. In the future, we will move them into Redis or memcache 
        '''        
        workingPath=self.getWorkingPath(group, APIShortName)
        expectationFile=self.getExpectationPath(workingPath)
        fileHandler=FileWrapper(expectationFile)
        if not fileHandler.isExist() or fileHandler.expired(5000):
            print 'Expectation file is not found or have been expired'
            return {}

        print 'Expectation file is avaliable'
        return fileHandler.loadDictFromJsonFile()