Changeset 14188 for main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py
- Timestamp:
- 26 Sep 2016, 05:13:42 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py
r14184 r14188 32 32 from ikobacustom.uniben.customers.export import ( 33 33 UnibenCustomerExporter, 34 UnibenCustomer DocumentExporter,34 UnibenCustomerPDFDocumentExporter, 35 35 RIAAContractExporter) 36 36 from ikobacustom.uniben.customers.batching import ( 37 37 UnibenCustomerProcessor, 38 UnibenCustomer DocumentProcessor,38 UnibenCustomerPDFDocumentProcessor, 39 39 RIAAContractProcessor) 40 40 from ikobacustom.uniben.testing import FunctionalLayer, samples_dir … … 61 61 IWorkflowState(customer).setState('started') 62 62 self.app['customers'].addCustomer(customer) 63 document = createObject(u'waeup.UnibenCustomer Document')63 document = createObject(u'waeup.UnibenCustomerPDFDocument') 64 64 document.title = u'My first document' 65 65 customer['documents'].addDocument(document) … … 83 83 'customer_id,email,firstname,lastname,middlename,phone,' 84 84 'reg_number,sex,suspended,suspended_comment,password,state,history\r\n' 85 ' K1000000,aa@aa.aa,Beate,Mueller,,,123,f,0,,,started,[]\r\n')85 'B1000000,aa@aa.aa,Beate,Mueller,,,123,f,0,,,started,[]\r\n') 86 86 # We can reimport the file ... 87 87 processor = UnibenCustomerProcessor() … … 94 94 self.assertEqual(num_fail,1) 95 95 # ... if we remove the original customer. 96 del self.app['customers'][' K1000000']96 del self.app['customers']['B1000000'] 97 97 result = processor.doImport( 98 98 self.outfile, … … 118 118 # set values we can expect in export file 119 119 self.setup_for_export() 120 exporter = UnibenCustomer DocumentExporter()120 exporter = UnibenCustomerPDFDocumentExporter() 121 121 exporter.export_all(self.app, self.outfile) 122 122 result = open(self.outfile, 'rb').read() 123 123 self.assertMatches(result, 124 124 'class_name,document_id,history,state,title,user_id\r\n' 125 'UnibenCustomer Document,%s,'125 'UnibenCustomerPDFDocument,%s,' 126 126 '[u\'2014-12-21 17:00:36 WAT - Document created by system\'],' 127 'created,My first document, K1000000\r\n'127 'created,My first document,B1000000\r\n' 128 128 % self.document.document_id) 129 129 # We can reimport the file if we change the header (user_id -> customer_id) 130 processor = UnibenCustomer DocumentProcessor()130 processor = UnibenCustomerPDFDocumentProcessor() 131 131 open(self.outfile, 'wb').write( 132 132 'customer_id,class_name,document_id,state,title\r\n' 133 ' K1000000,UnibenCustomerDocument,%s,started,My first title\r\n'133 'B1000000,UnibenCustomerPDFDocument,%s,started,My first title\r\n' 134 134 % self.document.document_id) 135 135 result = processor.doImport( … … 166 166 result = open(self.outfile, 'rb').read() 167 167 self.assertMatches(result, 168 'class_name,comment,contract_category,contract_id,document_object,' 168 'class_name,comment,contract_category,contract_id,' 169 'doc1,doc10,doc11,doc2,doc3,doc4,doc5,doc6,doc7,doc8,doc9,' 169 170 'fee_based,history,last_product_id,product_object,product_options,' 170 171 'state,tc_dict,title,user_id,valid_from,valid_to\r\n' 171 'RIAAContract,,riaa,%s,, 0,'172 'RIAAContract,,riaa,%s,,,,,,,,,,,,0,' 172 173 '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']' 173 ',,,[],created,{\'en\': u\'Hello World\'},, K1000000,,\r\n'174 ',,,[],created,{\'en\': u\'Hello World\'},,B1000000,,\r\n' 174 175 % self.contract.contract_id) 175 176 # We can reimport the file if we change the header (user_id -> customer_id) … … 181 182 'RIAAContract,riaa,%s,,' 182 183 '[u\'2014-12-21 22:26:00 WAT - Contract created by system\']' 183 ',,,[],created,{\'en\': u\'Hello World\'},, K1000000\r\n'184 ',,,[],created,{\'en\': u\'Hello World\'},,B1000000\r\n' 184 185 % self.contract.contract_id) 185 186 result = processor.doImport( … … 238 239 self.browser.getControl("Save").click() # submit form 239 240 self.assertFalse( 240 'href="http://localhost/app/customers/ K1000000/documents/DOC1/sample"'241 'href="http://localhost/app/customers/B1000000/documents/DOC1/sample"' 241 242 in self.browser.contents) 242 243 # ... but the correct upload submit button does … … 248 249 name='upload_samplescanmanageupload').click() 249 250 self.assertTrue( 250 'href="http://localhost/app/customers/ K1000000/documents/DOC1/sample"'251 'href="http://localhost/app/customers/B1000000/documents/DOC1/sample"' 251 252 in self.browser.contents) 252 253 # Browsing the link shows a real image
Note: See TracChangeset for help on using the changeset viewer.