tiramisu/test/test_config_domain.py

44 lines
1.2 KiB
Python
Raw Normal View History

import autopath
from py.test import raises
from tiramisu.config import Config
from tiramisu.option import DomainnameOption, OptionDescription
def test_domainname():
d = DomainnameOption('d', '')
e = DomainnameOption('e', '', "toto.com")
od = OptionDescription('a', '', [d, e])
c = Config(od)
2013-05-10 22:32:42 +02:00
c.read_write()
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')
e = DomainnameOption('e', '', "toto", type_='netbios')
od = OptionDescription('a', '', [d, e])
c = Config(od)
2013-05-10 22:32:42 +02:00
c.read_write()
raises(ValueError, "c.d = 'toto.com'")
c.d = 'toto'
raises(ValueError, "c.d = 'domainnametoolong'")
def test_domainname_hostname():
d = DomainnameOption('d', '', type_='hostname')
e = DomainnameOption('e', '', "toto", type_='hostname')
od = OptionDescription('a', '', [d, e])
c = Config(od)
2013-05-10 22:32:42 +02:00
c.read_write()
raises(ValueError, "c.d = 'toto.com'")
c.d = 'toto'
c.d = 'domainnametoolong'