- Timestamp:
- 30 Jan 2015, 07:48:39 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/createaccount.pt
r12039 r12521 16 16 </tbody> 17 17 </table> 18 <br /> 18 19 <p i18n:translate=""> 19 20 A customer record will be created and -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/requestpw.pt
r12039 r12521 16 16 </tbody> 17 17 </table> 18 <br /> 18 19 <p i18n:translate=""> 19 20 Your customer record will be looked up and -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py
r12500 r12521 30 30 31 31 from waeup.ikoba.customers.vocabularies import ( 32 contextual_reg_num_source, GenderSource, nats_vocab, 32 contextual_reg_num_source, contextual_email_source, 33 GenderSource, nats_vocab, 33 34 ConCatProductSource, CustomerDocumentSource, 34 35 ProductOptionSourceFactory) … … 125 126 ) 126 127 127 email = schema.ASCIILine(128 email = TextLineChoice( 128 129 title = _(u'Email'), 129 130 required = False, 130 131 constraint=validate_email, 132 source = contextual_email_source, 131 133 ) 132 134 … … 195 197 ) 196 198 197 email = schema. ASCIILine(199 email = schema.TextLine( 198 200 title = _(u'Email Address'), 199 201 required = True, … … 223 225 ) 224 226 225 email = schema.ASCIILine(226 title = _(u'Email Address'),227 required = True,227 email = TextLineChoice( 228 title = _(u'Email'), 229 required = False, 228 230 constraint=validate_email, 231 source = contextual_email_source, 229 232 ) 230 233 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_customer_data.csv
r11964 r12521 1 1 customer_id,firstname,lastname,reg_number,date_of_birth,,phone,sex,state 2 2 X666666,Aaren,Pieri,1,1990-01-02,aa@aa.ng,1234,M,requested 3 Y777777,Claus,Finau,2,1990-01-03, aa@aa.ng,1234,m,requested4 ,Susann,Berson,3,1990-01-04, aa@aa.ng,1234,F,requested5 ,Else,Mueller,4,1990-01-05, aa@aa.ng,1234,f,approved6 X888888,Alfons,Meier,5,1990-01-02, aa@aa.ng,1234,m,requested7 X999999,Herbert,Mueller,6,1990-01-02, aa@aa.ng,1234,m,approved8 X111111,Fabian,Riester,7,1990-01-02, aa@aa.ng,1234,m,requested9 X222222,Thomas,Kinderman,8,1990-01-02, aa@aa.ng,1234,m,requested10 X333333,Paula,Schall,9,1990-01-02, aa@aa.ng,1234,m,approved3 Y777777,Claus,Finau,2,1990-01-03,bb@aa.ng,1234,m,requested 4 ,Susann,Berson,3,1990-01-04,cc@aa.ng,1234,F,requested 5 ,Else,Mueller,4,1990-01-05,dd@aa.ng,1234,f,approved 6 X888888,Alfons,Meier,5,1990-01-02,ee@aa.ng,1234,m,requested 7 X999999,Herbert,Mueller,6,1990-01-02,ff@aa.ng,1234,m,approved 8 X111111,Fabian,Riester,7,1990-01-02,gg@aa.ng,1234,m,requested 9 X222222,Thomas,Kinderman,8,1990-01-02,hh@aa.ng,1234,m,requested 10 X333333,Paula,Schall,9,1990-01-02,ii@aa.ng,1234,m,approved -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_customer_data_duplicates.csv
r11964 r12521 1 1 customer_id,firstname,lastname,reg_number,date_of_birth,email,phone,password,sex,state 2 2 A123456,Aaren,Pieri,1,1990-01-02#,aa@aa.ng,1234,mypw1,m,requested 3 C123456,Aaren,Berson,2,1990-01-04,aa@aa.ng,1234,mypw1,m,approved 4 F123456,Frank,Meyer,1,1990-01-06,aa@aa.ng,1234,,m, 5 A123456,Uli,Schulz,3,1990-01-07,aa@aa.ng,1234,,m, 3 C123456,Aaren,Berson,2,1990-01-04,bb@aa.ng,1234,mypw1,m,approved 4 F123456,Frank,Meyer,1,1990-01-06,cc@aa.ng,1234,,m, 5 A123456,Uli,Schulz,3,1990-01-07,dd@aa.ng,1234,,m, 6 A234567,Berta,Pieri,4,1991-01-07,aa@aa.ng,1234,,m, -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r12388 r12521 139 139 customer.date_of_birth = datetime.date(1981, 2, 4) 140 140 #customer.sex = 'f' 141 customer.email = 'anna@sample.com'141 customer.email = u'anna@sample.com' 142 142 customer.phone = u'+234-123-12345' 143 143 customer.notice = u'Some notice\nin lines.' … … 279 279 self.csv_file_duplicates, CUSTOMER_HEADER_FIELDS_DUPLICATES) 280 280 content = open(fail_file).read() 281 self.assertEqual(num_warns, 2)281 self.assertEqual(num_warns,3) 282 282 self.assertEqual( 283 283 content, 284 284 'reg_number,password,firstname,lastname,sex,phone,state,date_of_birth,customer_id,email,--ERRORS--\r\n' 285 '1,,Frank,Meyer,m,1234,,1990-01-06,F123456, aa@aa.ng,reg_number: Invalid input\r\n'286 '3,,Uli,Schulz,m,1234,,1990-01-07,A123456, aa@aa.ng,This object already exists. Skipping.\r\n'287 285 '1,,Frank,Meyer,m,1234,,1990-01-06,F123456,cc@aa.ng,reg_number: Invalid input\r\n' 286 '3,,Uli,Schulz,m,1234,,1990-01-07,A123456,dd@aa.ng,This object already exists. Skipping.\r\n' 287 '4,,Berta,Pieri,m,1234,,1991-01-07,A234567,aa@aa.ng,email: Invalid input\r\n' 288 288 ) 289 289 shutil.rmtree(os.path.dirname(fin_file)) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12517 r12521 127 127 customer.reg_number = u'123' 128 128 customer.sex = u'm' 129 customer.email = 'aa@aa.ng'129 customer.email = u'aa@aa.ng' 130 130 customer.phone = u'1234' 131 131 customer.date_of_birth = date(1981, 2, 4) … … 210 210 self.browser.getControl(name="form.reg_number").value = '123' 211 211 self.browser.getControl("Create customer record").click() 212 self.assertTrue('Registration number exists already'212 self.assertTrue('Registration number does exist.' 213 213 in self.browser.contents) 214 214 self.browser.getControl(name="form.reg_number").value = '1234' … … 220 220 self.browser.getControl(name="form.reg_number").value = '123' 221 221 self.browser.getControl("Save").click() 222 self.assertMatches('...Registration number exists...',222 self.assertMatches('...Registration number does exist...', 223 223 self.browser.contents) 224 224 … … 358 358 self.browser.getControl("Send message now").click() 359 359 self.assertTrue('An smtp server error occurred' in self.browser.contents) 360 self.customer.email = 'xx@yy.zz'360 self.customer.email = u'xx@yy.zz' 361 361 self.browser.getControl("Send message now").click() 362 362 self.assertTrue('Your message has been sent' in self.browser.contents) … … 420 420 open('customers.csv', 'wb').write( 421 421 """firstname,lastname,reg_number,date_of_birth,email,phone,sex,password 422 Aaren,Pieri,1,1990-01-02, aa@aa.ng,1234,m,mypwd1423 Claus,Finau,2,1990-01-03, aa@aa.ng,1234,m,mypwd1424 Brit,Berson,2,1990-01-04, aa@aa.ng,1234,m,mypwd1422 Aaren,Pieri,1,1990-01-02,bb@aa.ng,1234,m,mypwd1 423 Claus,Finau,2,1990-01-03,cc@aa.ng,1234,m,mypwd1 424 Brit,Berson,2,1990-01-04,dd@aa.ng,1234,m,mypwd1 425 425 """) 426 426 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 766 766 767 767 def test_create_account(self): 768 # Customer with wrong number can't be found.769 768 self.browser.open('http://localhost/app/createaccount') 770 769 self.browser.getControl(name="form.firstname").value = 'Ruben' 771 770 self.browser.getControl(name="form.lastname").value = 'Gonzales' 771 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 772 self.browser.getControl("Send login credentials").click() 773 # Email address exists. 774 self.assertTrue('Email address does exist.' in self.browser.contents) 772 775 self.browser.getControl(name="form.email").value = 'newcustomer@xx.zz' 773 776 self.browser.getControl("Send login credentials").click() 774 self.assertTrue('Your request was successful.' 775 in self.browser.contents) 776 # ... and customer can be found in the catalog via the email address 777 self.assertTrue('Your request was successful.' in self.browser.contents) 778 # Customer can be found in the catalog via the email address 777 779 cat = queryUtility(ICatalog, name='customers_catalog') 778 780 results = list( -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py
r12445 r12521 62 62 63 63 class RegNumNotInSource(ValidationError): 64 """Registration number exists already64 """Registration number does exist. 65 65 """ 66 66 # The docstring of ValidationErrors is used as error description 67 67 # by zope.formlib. 68 pass 69 70 class EmailNotInSource(ValidationError): 71 """Email address does exist. 72 """ 68 73 pass 69 74 … … 121 126 directlyProvides(contextual_reg_num_source, IContextSourceBinder) 122 127 128 class EmailSource(RegNumberSource): 129 field_name = 'email' 130 validation_error = EmailNotInSource 131 132 def contextual_email_source(context): 133 source = EmailSource(context) 134 return source 135 directlyProvides(contextual_email_source, IContextSourceBinder) 136 123 137 124 138 class ConCatProductSource(BasicContextualSourceFactory):
Note: See TracChangeset for help on using the changeset viewer.