# imports from com.bitmechanic.maxq import HttpTestCase, EditorPane from junit.textui import TestRunner from java.lang import * from java.io import * from java.util import * from HTTPClient import NVPair import settings # definition of test class class MaxQTest(HttpTestCase): def __init__(self): HttpTestCase.__init__(self, "") def runTest(self): print '$Id: test_adm_imagetypes.py,v 1.4 2003/12/27 10:06:27 alex Exp $' #print "-> Connecting to MySQL database" db = settings.getDbConnection() #print "\tSuccess" print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_index") try: self.responseOK() except: print '/admin/image_type_index', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_add") try: self.responseOK() except: print '/admin/image_type_add', print "... %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''add_title''', '''QQQ''')) list.add(NVPair('''add_description''', '''QQQ''')) list.add(NVPair('''ResRules.by:records''', '''width''')) list.add(NVPair('''ResRules.cond:records''', '''more_then''')) list.add(NVPair('''ResRules.cond_value:records''', '''123''')) list.add(NVPair('''ResRules.resize_to:records''', '''124''')) list.add(NVPair('''ResRules.by:records''', '''width''')) list.add(NVPair('''ResRules.cond:records''', '''more_then''')) list.add(NVPair('''ResRules.cond_value:records''', '''234''')) list.add(NVPair('''ResRules.resize_to:records''', '''345''')) list.add(NVPair('''add_transform_rule''', '''none''')) list.add(NVPair('''add_category''', '''product''')) list.add(NVPair('''add_category''', '''''')) list.add(NVPair('''add_maxsize''', '''567''')) list.add(NVPair('''add_method.method:record''', '''manual''')) list.add(NVPair('''add_method.auto_from_image_type:record''', '''2''')) self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/add_image_type", list) print '.', try: self.responseOK() except: print '/admin/add_image_type', print "... %s" % self.getResponse().getStatusCode() self.printResponse() imagetype_id = db.loadVal("select max(imagetype_id) from image_types") print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_index") try: self.responseOK() except: print '/admin/image_type_index', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', list = ArrayList() list.add(NVPair('''imgtype_id''', imagetype_id)) self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_edit", list) try: self.responseOK() except: print '/admin/image_type_edit', print "... %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''h_action''', '''1''')) list.add(NVPair('''edit_save''', '''1''')) list.add(NVPair('''update_imagetype_id''', imagetype_id)) list.add(NVPair('''update_category''', '''''')) list.add(NVPair('''update_title''', '''QQQ''')) list.add(NVPair('''update_description''', '''QQQ123''')) list.add(NVPair('''ResRules.by:records''', '''width''')) list.add(NVPair('''ResRules.cond:records''', '''more_then''')) list.add(NVPair('''ResRules.cond_value:records''', '''123''')) list.add(NVPair('''ResRules.resize_to:records''', '''124''')) list.add(NVPair('''ResRules.by:records''', '''width''')) list.add(NVPair('''ResRules.cond:records''', '''more_then''')) list.add(NVPair('''ResRules.cond_value:records''', '''234''')) list.add(NVPair('''ResRules.resize_to:records''', '''345''')) list.add(NVPair('''ResRules.by:records''', '''width''')) list.add(NVPair('''ResRules.cond:records''', '''more_then''')) list.add(NVPair('''ResRules.cond_value:records''', '''''')) list.add(NVPair('''ResRules.resize_to:records''', '''''')) list.add(NVPair('''update_transform_rule''', '''keep original image format''')) list.add(NVPair('''update_maxsize''', '''567''')) list.add(NVPair('''add_method.method:record''', '''manual''')) list.add(NVPair('''add_method.auto_from_image_type:record''', '''2''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/update_image_type", list) try: self.responseOK() except: print '/admin/update_image_type', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_index") try: self.responseOK() except: print '/admin/image_type_index', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', list = ArrayList() list.add(NVPair('''imagetype_id''', imagetype_id)) self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_del", list) try: self.responseOK() except: print '/admin/image_type_del', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', list = ArrayList() list.add(NVPair('''del_imagetype_id''', imagetype_id)) self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/delete_image_type", list) try: self.responseOK() except: print '/admin/delete_image_types', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/admin/image_type_index") try: self.responseOK() except: print '/admin/image_type_index', print "... %s" % self.getResponse().getStatusCode() self.printResponse() print ' ' ########################################## # Code to load and run the test test = MaxQTest() settings.setAuthorization(test) test.runTest()