test uppercase character before valid domain name for better error message
This commit is contained in:
@ -5,6 +5,7 @@ from py.test import raises
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import DomainnameOption, EmailOption, URLOption, OptionDescription
|
||||
from tiramisu.error import ValueWarning
|
||||
from tiramisu.i18n import _
|
||||
|
||||
|
||||
def test_domainname():
|
||||
@ -36,6 +37,29 @@ def test_domainname():
|
||||
c.g = '192.168.1.29'
|
||||
|
||||
|
||||
def test_domainname_upper():
|
||||
d = DomainnameOption('d', '')
|
||||
od = OptionDescription('a', '', [d])
|
||||
c = Config(od)
|
||||
c.read_write()
|
||||
c.d = 'toto.com'
|
||||
msg = _('some characters are uppercase')
|
||||
has_error = False
|
||||
try:
|
||||
c.d = 'TOTO.COM'
|
||||
except ValueError, err:
|
||||
assert msg in unicode(err)
|
||||
has_error = True
|
||||
assert has_error is True
|
||||
has_error = False
|
||||
try:
|
||||
c.d = 'toTo.com'
|
||||
except ValueError, err:
|
||||
assert msg in unicode(err)
|
||||
has_error = True
|
||||
assert has_error is True
|
||||
|
||||
|
||||
def test_domainname_warning():
|
||||
d = DomainnameOption('d', '', warnings_only=True)
|
||||
f = DomainnameOption('f', '', allow_without_dot=True, warnings_only=True)
|
||||
|
Reference in New Issue
Block a user