tiramisu/test/test_config_domain.py
Emmanuel Garette 6de65859b4 * config herite from BaseInformation class
* _cfgimpl_ => _impl_
* optimpl_ => impl_
* properties/permissives are now set/frozenset
* validation raise ValueError if not valid, didn't return anything otherwise
* consistencies are now validate in setting and when deleting value
* ip/network with netmask consistency now works
* DomainnameOption now works
* if no validation, don't set cache for value
* symlinkoption: remove path (not used)
2013-05-08 18:14:42 +02:00

37 lines
994 B
Python

import autopath
from py.test import raises
from tiramisu.config import Config
from tiramisu.option import DomainnameOption, OptionDescription
def test_domainname():
d = DomainnameOption('d', '')
od = OptionDescription('a', '', [d])
c = Config(od)
c.d = 'toto.com'
raises(ValueError, "c.d = 'toto'")
c.d = 'toto3.com'
c.d = 'toto3.3la'
raises(ValueError, "c.d = '3toto.com'")
c.d = 'toto.co3'
raises(ValueError, "c.d = 'toto_super.com'")
c.d = 'toto-.com'
def test_domainname_netbios():
d = DomainnameOption('d', '', type_='netbios')
od = OptionDescription('a', '', [d])
c = Config(od)
raises(ValueError, "c.d = 'toto.com'")
c.d = 'toto'
raises(ValueError, "c.d = 'domainnametoolong'")
def test_domainname_hostname():
d = DomainnameOption('d', '', type_='hostname')
od = OptionDescription('a', '', [d])
c = Config(od)
raises(ValueError, "c.d = 'toto.com'")
c.d = 'toto'
c.d = 'domainnametoolong'