Changeset 14188 for main/ikobacustom.uniben/trunk
- Timestamp:
- 26 Sep 2016, 05:13:42 (8 years ago)
- Location:
- main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/interfaces.py
r14184 r14188 52 52 """ 53 53 54 document_object = schema.Choice( 55 title = _(u'Document'), 56 source = CustomerDocumentSource(), 57 required = False, 58 ) 59 60 document_object2 = schema.Choice( 61 title = _(u'Document 2'), 54 doc1 = schema.Choice( 55 title = _(u'Biographical Citation'), 56 source = CustomerDocumentSource(), 57 required = False, 58 ) 59 60 doc2 = schema.Choice( 61 title = _(u'Supporting Statement'), 62 source = CustomerDocumentSource(), 63 required = False, 64 ) 65 66 doc3 = schema.Choice( 67 title = _(u'Narrative Write-Up'), 68 source = CustomerDocumentSource(), 69 required = False, 70 ) 71 72 doc4 = schema.Choice( 73 title = _(u'Itemized Statement'), 74 source = CustomerDocumentSource(), 75 required = False, 76 ) 77 78 doc5 = schema.Choice( 79 title = _(u'Significant Publivations'), 80 source = CustomerDocumentSource(), 81 required = False, 82 ) 83 84 doc6 = schema.Choice( 85 title = _(u'Curriculum Vitae'), 86 source = CustomerDocumentSource(), 87 required = False, 88 ) 89 90 doc7 = schema.Choice( 91 title = _(u'Previous Awards'), 92 source = CustomerDocumentSource(), 93 required = False, 94 ) 95 96 doc8 = schema.Choice( 97 title = _(u'Leadership Roles'), 98 source = CustomerDocumentSource(), 99 required = False, 100 ) 101 102 doc9 = schema.Choice( 103 title = _(u'Photos and Illustrations'), 104 source = CustomerDocumentSource(), 105 required = False, 106 ) 107 108 109 doc10 = schema.Choice( 110 title = _(u'State of H-Index'), 111 source = CustomerDocumentSource(), 112 required = False, 113 ) 114 115 doc11 = schema.Choice( 116 title = _(u'Reference Letters'), 62 117 source = CustomerDocumentSource(), 63 118 required = False, … … 97 152 """ 98 153 99 document_object = schema.Choice( 100 title = _(u'Document'), 101 source = CustomerDocumentSource(), 102 required = True, 103 ) 104 105 document_object2 = schema.Choice( 106 title = _(u'Document 2'), 107 source = CustomerDocumentSource(), 108 required = True, 109 ) 154 doc1 = schema.Choice( 155 title = _(u'Biographical Citation'), 156 source = CustomerDocumentSource(), 157 required = True, 158 ) 159 160 doc2 = schema.Choice( 161 title = _(u'Supporting Statement'), 162 source = CustomerDocumentSource(), 163 required = True, 164 ) 165 166 doc3 = schema.Choice( 167 title = _(u'Narrative Write-Up'), 168 source = CustomerDocumentSource(), 169 required = True, 170 ) 171 172 doc4 = schema.Choice( 173 title = _(u'Itemized Statement'), 174 source = CustomerDocumentSource(), 175 required = True, 176 ) 177 178 doc5 = schema.Choice( 179 title = _(u'Significant Publivations'), 180 source = CustomerDocumentSource(), 181 required = True, 182 ) 183 184 doc6 = schema.Choice( 185 title = _(u'Curriculum Vitae'), 186 source = CustomerDocumentSource(), 187 required = True, 188 ) 189 190 doc7 = schema.Choice( 191 title = _(u'Previous Awards'), 192 source = CustomerDocumentSource(), 193 required = True, 194 ) 195 196 doc8 = schema.Choice( 197 title = _(u'Leadership Roles'), 198 source = CustomerDocumentSource(), 199 required = True, 200 ) 201 202 doc9 = schema.Choice( 203 title = _(u'Photos and Illustrations'), 204 source = CustomerDocumentSource(), 205 required = True, 206 ) 207 208 209 doc10 = schema.Choice( 210 title = _(u'State of H-Index'), 211 source = CustomerDocumentSource(), 212 required = True, 213 ) 214 215 doc11 = schema.Choice( 216 title = _(u'Reference Letters'), 217 source = CustomerDocumentSource(), 218 required = True, 219 ) -
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 -
main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_customer.py
r14181 r14188 62 62 verify.verifyObject(IUnibenCustomer, customer) 63 63 self.app['customers'].addCustomer(customer) 64 self.assertEqual(customer.customer_id, ' K1000000')65 self.assertEqual(self.app['customers'][' K1000000'], customer)64 self.assertEqual(customer.customer_id, 'B1000000') 65 self.assertEqual(self.app['customers']['B1000000'], customer) 66 66 return 67 67
Note: See TracChangeset for help on using the changeset viewer.