38 lines
994 B
Python
38 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'
|