Changeset 12004 for main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Timestamp:
- 20 Nov 2014, 04:11:18 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_document_data.csv
r11995 r12004 1 id,reg_number,title1 document_id,reg_number,title 2 2 d1266236341953,1,My first doc 3 3 d1266236341954,2,My second doc -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r11997 r12004 1 1 # -*- coding: utf-8 -*- 2 ## $Id : test_batching.py 11756 2014-07-09 12:46:08Z henrik$2 ## $Id$ 3 3 ## 4 4 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann … … 259 259 self.customer = self.app['customers'][customer.customer_id] 260 260 document = createObject(u'waeup.CustomerDocument') 261 document. id = 'd120'262 self.customer['documents'][document. id] = document261 document.document_id = 'd120' 262 self.customer['documents'][document.document_id] = document 263 263 264 264 # Import customers with subobjects … … 282 282 def test_getEntry(self): 283 283 assert self.processor.getEntry( 284 dict(customer_id='ID_NONE', id='nonsense'), self.app) is None285 assert self.processor.getEntry( 286 dict(customer_id=self.customer.customer_id, id='d120'),284 dict(customer_id='ID_NONE', document_id='nonsense'), self.app) is None 285 assert self.processor.getEntry( 286 dict(customer_id=self.customer.customer_id, document_id='d120'), 287 287 self.app) is self.customer['documents']['d120'] 288 288 289 289 def test_delEntry(self): 290 290 assert self.processor.getEntry( 291 dict(customer_id=self.customer.customer_id, id='d120'),291 dict(customer_id=self.customer.customer_id, document_id='d120'), 292 292 self.app) is self.customer['documents']['d120'] 293 293 self.assertEqual(len(self.customer['documents'].keys()),1) 294 294 self.processor.delEntry( 295 dict(customer_id=self.customer.customer_id, id='d120'),295 dict(customer_id=self.customer.customer_id, document_id='d120'), 296 296 self.app) 297 297 assert self.processor.getEntry( 298 dict(customer_id=self.customer.customer_id, id='d120'),298 dict(customer_id=self.customer.customer_id, document_id='d120'), 299 299 self.app) is None 300 300 self.assertEqual(len(self.customer['documents'].keys()),0) … … 303 303 self.assertEqual(len(self.customer['documents'].keys()),1) 304 304 document1 = createObject(u'waeup.CustomerDocument') 305 document1. id = 'p234'305 document1.document_id = 'p234' 306 306 self.processor.addEntry( 307 document1, dict(customer_id=self.customer.customer_id, id='p234'),307 document1, dict(customer_id=self.customer.customer_id, document_id='p234'), 308 308 self.app) 309 309 self.assertEqual(len(self.customer['documents'].keys()),2) 310 self.assertEqual(self.customer['documents']['p234']. id, 'p234')310 self.assertEqual(self.customer['documents']['p234'].document_id, 'p234') 311 311 document2 = createObject(u'waeup.CustomerDocument') 312 document1. id = 'nonsense'312 document1.document_id = 'nonsense' 313 313 314 314 def test_checkConversion(self): 315 315 errs, inv_errs, conv_dict = self.processor.checkConversion( 316 dict( id='d1266236341955'))316 dict(document_id='d1266236341955')) 317 317 self.assertEqual(len(errs),0) 318 318 errs, inv_errs, conv_dict = self.processor.checkConversion( 319 dict( id='nonsense'))319 dict(document_id='nonsense')) 320 320 self.assertEqual(len(errs),1) 321 321 timestamp = ("%d" % int(time()*10000))[1:] 322 id = "d%s" % timestamp323 errs, inv_errs, conv_dict = self.processor.checkConversion( 324 dict( id=id))322 document_id = "d%s" % timestamp 323 errs, inv_errs, conv_dict = self.processor.checkConversion( 324 dict(document_id=document_id)) 325 325 self.assertEqual(len(errs),0) 326 326 … … 330 330 self.assertEqual(num_warns,0) 331 331 document = self.processor.getEntry(dict(reg_number='1', 332 id='d1266236341953'), self.app)332 document_id='d1266236341953'), self.app) 333 333 self.assertEqual( 334 334 self.app['customers']['X666666']['documents']['d1266236341953'], 335 335 document) 336 self.assertEqual(document. id, 'd1266236341953')336 self.assertEqual(document.document_id, 'd1266236341953') 337 337 document = self.processor.getEntry(dict(reg_number='3', 338 id='d1266236341955'), self.app)338 document_id='d1266236341955'), self.app) 339 339 shutil.rmtree(os.path.dirname(fin_file)) 340 340 logcontent = open(self.logfile).read() … … 343 343 'INFO - system - CustomerDocument Processor - ' 344 344 'sample_document_data - X666666 - updated: ' 345 ' id=d1266236341953, title=My first doc'345 'document_id=d1266236341953, title=My first doc' 346 346 in logcontent) 347 347 … … 355 355 num, num_warns, fin_file, fail_file = self.processor.doImport( 356 356 self.csv_file, DOCUMENT_HEADER_FIELDS,'update') 357 self.assertEqual(num_warns,1) # There is one record without id357 self.assertEqual(num_warns,1) # There is one record without document_id 358 358 shutil.rmtree(os.path.dirname(fin_file)) 359 359 … … 367 367 num, num_warns, fin_file, fail_file = self.processor.doImport( 368 368 self.csv_file, DOCUMENT_HEADER_FIELDS,'remove') 369 self.assertEqual(num_warns,1) # There is one record without id369 self.assertEqual(num_warns,1) # There is one record without document_id 370 370 shutil.rmtree(os.path.dirname(fin_file)) 371 371 logcontent = open(self.logfile).read() -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_document.py
r11997 r12004 1 ## $Id : tests.py 9469 2012-10-30 17:49:17Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann … … 57 57 container = CustomerDocumentsContainer() 58 58 document = createObject(u'waeup.CustomerDocument') 59 document.id = 'my_document'59 id = document.document_id 60 60 container.addDocument(document) 61 self.assertEqual(container[ 'my_document'], document)61 self.assertEqual(container[id], document) 62 62 self.assertRaises(TypeError, container.addDocument, object()) 63 63 return
Note: See TracChangeset for help on using the changeset viewer.