# 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: test0_create_zwarehouse.py,v 1.5 2005/06/03 nata Exp $' print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_workspace") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_workspace''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_main") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_main''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_addProduct/ZWarehouse/addForm") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_addProduct/ZWarehouse/addForm''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', list = ArrayList() list.add(NVPair('''id''', '''ZWarehouse''')) list.add(NVPair('''title''', '''shopping cart''')) list.add(NVPair('''zw_store_owner_name''', '''John Doe''')) list.add(NVPair('''zw_store_emails_from''', '''info@zwarehouse.org''')) list.add(NVPair('''zw_add_admin''', '''1''')) list.add(NVPair('''zw_add_db''', '''1''')) list.add(NVPair('''submit''', ''' Add ''')) self.post("http://devel.z.halogen.kharkov.ua/manage_addProduct/ZWarehouse/manage_addZWarehouse", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_addProduct/ZWarehouse/manage_addZWarehouse?id=ZWarehouse&title=shopping cart&zw_store_owner_name=John Doe&zw_store_emails_from=info@zwarehouse.org&zw_add_admin=1&zw_add_db=1&submit= Add''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''update_menu''', '''1''')) print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_main", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_main?update_menu=1''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_menu") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_menu''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''ids:list''', '''ZWarehouseAdmin''')) list.add(NVPair('''ids:list''', '''ZWarehouseDB''')) list.add(NVPair('''manage_cutObjects:method''', '''Cut''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/?ids:list=ZWarehouseAdmin&ids:list=ZWarehouseDB&manage_cutObjects:method=Cut''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_workspace") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_workspace''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_main") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_main''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''manage_pasteObjects:method''', '''Paste''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse/", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse/?manage_pasteObjects:method=Paste''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_menu") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_menu''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''ids:list''', '''ZWarehouseAdmin''')) list.add(NVPair('''manage_renameForm:method''', '''Rename''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse/", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse/?ids:list=ZWarehouseAdmin&manage_renameForm:method=Rename''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''ids:list''', '''ZWarehouseAdmin''')) list.add(NVPair('''new_ids:list''', '''admin''')) list.add(NVPair(''':default_method''', '''manage_renameObjects''')) list.add(NVPair('''manage_renameObjects:method''', ''' Ok ''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse?ids:list=ZWarehouseAdmin&new_ids:list=admin&:default_method=manage_renameObjects&manage_renameObjects:method= Ok''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/manage_menu") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/manage_menu''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', self.get("http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_propertiesForm") try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse/manage_propertiesForm''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() list = ArrayList() list.add(NVPair('''title:UTF-8:string''', '''shopping cart''')) list.add(NVPair('''zw_store_name:UTF-8:string''', '''shopping cart''')) list.add(NVPair('''zw_store_owner_name:UTF-8:string''', '''John Doe''')) list.add(NVPair('''zw_store_emails_from:UTF-8:string''', '''info@zwarehouse.org''')) list.add(NVPair('''zw_def_language_id:int''', '''1''')) list.add(NVPair('''zw_def_reseller_id:int''', '''1''')) list.add(NVPair('''zw_def_currency_id:int''', '''1''')) list.add(NVPair('''zw_def_country_id:int''', '''223''')) list.add(NVPair('''zw_def_region_id:int''', '''131''')) list.add(NVPair('''zw_def_unit_of_weight_measurement:UTF-8:string''', '''metric''')) list.add(NVPair('''zw_def_weight_measure:UTF-8:string''', '''KGS''')) list.add(NVPair('''zw_shipment_check_address_city:UTF-8:string''', '''Miami''')) list.add(NVPair('''zw_shipment_check_address_country:UTF-8:string''', '''US''')) list.add(NVPair('''zw_shipment_check_address_zip:UTF-8:string''', '''33196''')) list.add(NVPair('''zw_shipment_check_address_street:UTF-8:string''', '''49 ave.''')) list.add(NVPair('''zw_ssl_url:UTF-8:string''', '''''')) list.add(NVPair('''zw_user_registration_fields:UTF-8:lines''', '''username,required,Username email,required,Email address''')) list.add(NVPair('''zw_passwordLength:int''', '''8''')) list.add(NVPair('''zw_option_fields_description:UTF-8:lines''', '''zw_store_name,Store Name,Used in mails sent to customers. shop_url,Store URL / Internal, Internal setting for relocating store into some other directory. Very rarely needed. zw_store_owner_name,Store Owner, This variable used into mails which sent to customers zw_store_emails_from, Emails From address, Email address from which all emails are sent zw_def_language_id, Default language, Default language zw_def_reseller_id, Default Reseller, If you have more then 1 reseller of a products set this to a default. This is needed only to count tax for standard user. Tax will be counted depending on reseller region. zw_def_currency_id, Default currency, Default currency for catalog of products zw_def_country_id, Default country, Used for (a) default tax calculation (b) this country also becames default on any country selects. zw_def_region_id,Default Region, default region for tax calculations for non-logged users zw_def_unit_of_weight_measurement, Default Unit of weight measurement, Possible choices: "metric" or "english". Used for shipment calculations. zw_def_weight_measure, Default weight measure, Used for shipment calculations. Set current weight measure in the store. Possible values: KGS or LBS zw_is_new_account_restricted,Is new user account resticted, If enabled: initial user password will be sent via Email. If disabled: user can specify any password (as result email address of user is not validated and can be fake) zw_shipment_check_address_city, Address: City to check shipment with, zw_shipment_check_address_country, Address: Country to check shipment with, zw_shipment_check_address_zip,Shipment check: ZIP, zw_shipment_check_address_street,Shipment check: street, zw_always_include_tax_to_product_price,Always include tax to product price, In some countries it is not allowed to display any product price without tax included. In other countries this is allowed. Set it according to your needs / local rules. zw_enable_ssl,Enable SSL, If this set to "Enabled" then all sensetive information will be sent via SSL. zw_user_registration_fields, User Registration Fields, Which information is required for user registration? Possible choices are: "username/email/ first_name/last_name/phone/fax. zw_passwordLength, Password length, user minimal password length zw_option_fields_description, My Store fields descriptions, Internal descriptions for configuration options. Usually there are no need to edit it. zw_ssl_url,Store SSL URL, this variable is used only when your SSL address is not the same as store address. By default store adds https:// to the URL if this option is not specified. zw_customer_group,Customer group zw_encrypted_password,, If enabled: passwords will be encrypted one-way algorithm. zw_cart_require_login,,Restrict users to manage cart only after login''')) list.add(NVPair('''zw_def_categories_list_type_id:int''', '''1''')) list.add(NVPair('''zw_def_products_list_type_id:int''', '''3''')) list.add(NVPair('''zw_shipment_check_address_country_code:UTF-8:string''', '''US''')) list.add(NVPair('''zw_shipment_check_address_region:UTF-8:string''', '''Miami''')) list.add(NVPair('''zw_customer_group:UTF-8:string''', '''users''')) list.add(NVPair('''zw_encrypted_passwords:boolean''', '''on''')) list.add(NVPair('''zw_db_location:UTF-8:string''', '''ZWarehouseDB''')) list.add(NVPair('''zw_admin_location:UTF-8:string''', '''admin''')) list.add(NVPair('''zw_version:UTF-8:string''', '''0.9.1/$Rev: 440 $''')) list.add(NVPair('''zw_upcoming_event_types:UTF-8:lines''', '''Business Information Sessions Product Training Sessions''')) list.add(NVPair('''no_tax_is_zero:boolean''', '''on''')) list.add(NVPair('''zw_exchange_rates:UTF-8:lines''', '''''')) list.add(NVPair('''zw_products_list_default_limit:int''', '''15''')) list.add(NVPair('''manage_editProperties:method''', '''Save Changes''')) print '.', self.post("http://devel.z.halogen.kharkov.ua/ZWarehouse", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://devel.z.halogen.kharkov.ua/ZWarehouse?title:UTF-8:string=shopping cart&zw_store_name:UTF-8:string=shopping cart&zw_store_owner_name:UTF-8:string=John Doe&zw_store_emails_from:UTF-8:string=info@zwarehouse.org&zw_def_language_id:int=1&zw_def_reseller_id:int=1&zw_def_currency_id:int=1&zw_def_country_id:int=223&zw_def_region_id:int=131&zw_def_unit_of_weight_measurement:UTF-8:string=metric&zw_def_weight_measure:UTF-8:string=KGS&zw_shipment_check_address_city:UTF-8:string=Miami&zw_shipment_check_address_country:UTF-8:string=US&zw_shipment_check_address_zip:UTF-8:string=33196&zw_shipment_check_address_street:UTF-8:string=49 ave.&zw_ssl_url:UTF-8:string=&zw_user_registration_fields:UTF-8:lines=username,required,Username email,required,Email address&zw_passwordLength:int=8&zw_option_fields_description:UTF-8:lines=zw_store_name,Store Name,Used in mails sent to customers. shop_url,Store URL / Internal, Internal setting for relocating store into some other directory. Very rarely needed. zw_store_owner_name,Store Owner, This variable used into mails which sent to customers zw_store_emails_from, Emails From address, Email address from which all emails are sent zw_def_language_id, Default language, Default language zw_def_reseller_id, Default Reseller, If you have more then 1 reseller of a products set this to a default. This is needed only to count tax for standard user. Tax will be counted depending on reseller region. zw_def_currency_id, Default currency, Default currency for catalog of products zw_def_country_id, Default country, Used for (a) default tax calculation (b) this country also becames default on any country selects. zw_def_region_id,Default Region, default region for tax calculations for non-logged users zw_def_unit_of_weight_measurement, Default Unit of weight measurement, Possible choices: "metric" or "english". Used for shipment calculations. zw_def_weight_measure, Default weight measure, Used for shipment calculations. Set current weight measure in the store. Possible values: KGS or LBS zw_is_new_account_restricted,Is new user account resticted, If enabled: initial user password will be sent via Email. If disabled: user can specify any password (as result email address of user is not validated and can be fake) zw_shipment_check_address_city, Address: City to check shipment with, zw_shipment_check_address_country, Address: Country to check shipment with, zw_shipment_check_address_zip,Shipment check: ZIP, zw_shipment_check_address_street,Shipment check: street, zw_always_include_tax_to_product_price,Always include tax to product price, In some countries it is not allowed to display any product price without tax included. In other countries this is allowed. Set it according to your needs / local rules. zw_enable_ssl,Enable SSL, If this set to "Enabled" then all sensetive information will be sent via SSL. zw_user_registration_fields, User Registration Fields, Which information is required for user registration? Possible choices are: "username/email/ first_name/last_name/phone/fax. zw_passwordLength, Password length, user minimal password length zw_option_fields_description, My Store fields descriptions, Internal descriptions for configuration options. Usually there are no need to edit it. zw_ssl_url,Store SSL URL, this variable is used only when your SSL address is not the same as store address. By default store adds https:// to the URL if this option is not specified. zw_customer_group,Customer group zw_encrypted_password,, If enabled: passwords will be encrypted one-way algorithm. zw_cart_require_login,,Restrict users to manage cart only after login&zw_def_categories_list_type_id:int=1&zw_def_products_list_type_id:int=3&zw_shipment_check_address_country_code:UTF-8:string=US&zw_shipment_check_address_region:UTF-8:string=Miami&zw_customer_group:UTF-8:string=users&zw_encrypted_passwords:boolean=on&zw_db_location:UTF-8:string=ZWarehouseDB&zw_admin_location:UTF-8:string=admin&zw_version:UTF-8:string=0.9.1/$Rev: 440 $&zw_upcoming_event_types:UTF-8:lines=Business Information Sessions Product Training Sessions&no_tax_is_zero:boolean=on&zw_exchange_rates:UTF-8:lines=&zw_products_list_default_limit:int=15&manage_editProperties:method=Save Changes''') print "Response code: %s" % self.getResponse().getStatusCode() self.printResponse() print '.', # delete standard_error_message so testing is easier list = ArrayList() list.add(NVPair('''ids:list''', '''standard_error_message''')) list.add(NVPair('''manage_delObjects:method''', '''Delete''')) self.post("http://zwdev:9086/dev/ZWarehouse/", list) try: self.responseOK() except: print "Testing URL: %s" % self.replaceURL('''http://zwdev:9086/dev/ZWarehouse/?ids:list=standard_error_message&manage_delObjects:method=Delete''') print 'error deleting standard_error_message' print ' ' ########################################## # Code to load and run the test test = MaxQTest() settings.setAuthorization(test) test.runTest()