def createProductInstance(productTemplateId, accountTemplateId, definition, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions={ "{templateId}": productTemplateId, "{accountTemplateId}": accountTemplateId }) return o_utils.createInstance("product", testData, contentType=contentType)
def createSubscriptionInstance(subscriptionTemplateId, userTemplateId, productId, userId, shortCode, definition): testData = t_utils.getTestData(definition, substitutions={ "{templateId}": subscriptionTemplateId, "{userTemplateId}": userTemplateId, "{productId}": productId, "{userId}": userId, "{shortCode}": shortCode }) return o_utils.createInstance("subscription", testData)
def loadTemplateFromFile(definitionFile): testTemplate = t_utils.getTestData(definitionFile) template = eval(loadTemplate(testTemplate)) templateId = template["id"] return templateId
testData = t_utils.getTestData(definition, substitutions={ "{templateId}": productTemplateId, "{accountTemplateId}": accountTemplateId }) return o_utils.createInstance("product", testData, contentType=contentType) def createUserInstance(userTemplateId, accountId, definition, case=None, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions={ "{templateId}": userTemplateId, "{accountId}": accountId }, case=case) return o_utils.createInstance("user", testData, contentType=contentType) def createSubscriptionInstance(subscriptionTemplateId, userTemplateId, productId, userId, shortCode, definition): testData = t_utils.getTestData(definition, substitutions={ "{templateId}": subscriptionTemplateId, "{userTemplateId}": userTemplateId, "{productId}": productId, "{userId}": userId, "{shortCode}": shortCode })
def queryInstance(type, definition, substitutions = {}, case=0): testData = t_utils.getTestData(definition, substitutions = substitutions, case=case) print testData return o_utils.makeQuery(type, testData)
def updateUser(accountId, definition, case=0, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions = {}, case=case) return o_utils.applyDelta("user/"+accountId, testData, contentType=contentType)
def setStatus(type, objectId, status, definition, case=0): testData = t_utils.getTestData(definition, substitutions = {"{status}":status}, case=case) return o_utils.applyDelta(type+"/"+objectId, testData)
def setAccountMainUser(accountId, userId, definition, case=0, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions = {"{userId}":userId}, case=case) return o_utils.applyDelta("account/"+accountId, testData, contentType=contentType)
def createAccountInstance(accountTemplateId, userTemplateId, productId, subProductId1, subProductId2, userId, shortCode, definition, case=0, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions = {"{templateId}":accountTemplateId,"{userTemplateId}":userTemplateId,"{productId}":productId,"{eCntProductId}":subProductId1,"{eCKProductId}":subProductId2,"{userId}":userId,"{shortCode}":shortCode}, case=case) #print testData return o_utils.createInstance("account", testData, contentType=contentType)
def createSubscriptionInstance(subscriptionTemplateId, userTemplateId, productId, userId, shortCode, definition): testData = t_utils.getTestData(definition, substitutions = {"{templateId}":subscriptionTemplateId,"{userTemplateId}":userTemplateId,"{productId}":productId,"{userId}":userId,"{shortCode}":shortCode}) return o_utils.createInstance("subscription", testData)
def createUserInstance(userTemplateId, accountId, definition, case=None, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions = {"{templateId}":userTemplateId, "{accountId}": accountId}, case=case) return o_utils.createInstance("user", testData, contentType=contentType)
def createProductInstance(productTemplateId, accountTemplateId, definition, contentType="text/xml"): testData = t_utils.getTestData(definition, substitutions = {"{templateId}":productTemplateId, "{accountTemplateId}":accountTemplateId}) return o_utils.createInstance("product", testData, contentType=contentType)