Back to index

plone3  3.1.7
Public Member Functions
Archetypes.tests.test_validation.TestValidation Class Reference
Inheritance diagram for Archetypes.tests.test_validation.TestValidation:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.tests.test_validation.TestValidation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_inNumericRange
def test_isPrintable
def test_isSSN
def test_isUSPhoneNumber
def test_isURL
def test_isEmail
def test_isUnixLikeName

Detailed Description

Definition at line 30 of file test_validation.py.


Member Function Documentation

Definition at line 31 of file test_validation.py.

00031 
00032     def test_inNumericRange(self):
00033         v = validationService.validatorFor('inNumericRange')
00034         self.failUnlessEqual(v(10, 1, 20), 1)
00035         self.failUnlessEqual(v('10', 1, 20), 1)
00036         self.failIfEqual(v(0, 4, 5), 1)

Definition at line 65 of file test_validation.py.

00065 
00066     def test_isEmail(self):
00067         v = validationService.validatorFor('isEmail')
00068         self.failUnlessEqual(v('test@test.com'), 1)
00069         self.failIfEqual(v('@foo.bar'), 1)
00070         self.failIfEqual(v('me'), 1)

Definition at line 37 of file test_validation.py.

00037 
00038     def test_isPrintable(self):
00039         v = validationService.validatorFor('isPrintable')
00040         self.failUnlessEqual(v('text'), 1)
00041         self.failIfEqual(v('\u203'), 1)
00042         self.failIfEqual(v(10), 1)

Definition at line 43 of file test_validation.py.

00043 
00044     def test_isSSN(self):
00045         v = validationService.validatorFor('isSSN')
00046         self.failUnlessEqual(v('111223333'), 1)
00047         self.failUnlessEqual(v('111-22-3333', ignore=r'-'), 1)

Definition at line 71 of file test_validation.py.

00071 
00072     def test_isUnixLikeName(self):
00073         v = validationService.validatorFor('isUnixLikeName')
00074         self.failUnlessEqual(v('abcd'), 1)
00075         self.failUnlessEqual(v('a_123456'), 1)
00076         self.failIfEqual(v('123'), 1)
00077         self.failIfEqual(v('ab.c'), 1)
00078         self.failIfEqual(v('ab,c'),1 )
00079         self.failIfEqual(v('aaaaaaaab'), 1) # too long
00080 

Definition at line 58 of file test_validation.py.

00058 
00059     def test_isURL(self):
00060         v = validationService.validatorFor('isURL')
00061         self.failUnlessEqual(v('http://foo.bar:8080/manage'), 1)
00062         self.failIfEqual(v('http://\n'), 1)
00063         self.failIfEqual(v('../foo/bar'), 1)
00064 

Definition at line 48 of file test_validation.py.

00048 
00049     def test_isUSPhoneNumber(self):
00050         v = validationService.validatorFor('isUSPhoneNumber')
00051         self.failUnlessEqual(v('(212) 555-1212',
00052                                ignore=r'[\s\(\)\-]'), 1)
00053         self.failUnlessEqual(v('2125551212',
00054                                ignore=r'[\s\(\)\-]'), 1)
00055 
00056         self.failUnlessEqual(v('(212) 555-1212'), 1)
00057 


The documentation for this class was generated from the following file: