Beispiel #1
0
 def test_raise_limit_and_try_valid_len_hostname(self):
     """Raise limit above default and test hostname with length
     in between default 64 and the new value. Should pass"""
     testhost = HostTracker(name=u'testhost',
                            fqdn=u'{}'.format(
                                self.generate_hostname(MAXHOSTNAMELEN + 1)))
     self.modify_config_maxhostname(testhost, MAXHOSTNAMELEN * 2)
     testhost.create()
     testhost.ensure_missing()
Beispiel #2
0
 def test_try_hostname_length_below_maximum(self):
     """Try to create host with valid hostname. Should pass"""
     valid_length = MAXHOSTNAMELEN // 2
     testhost = HostTracker(name=u'testhost',
                            fqdn=u'{}'.format(
                                self.generate_hostname(valid_length)))
     self.modify_config_maxhostname(testhost, MAXHOSTNAMELEN)
     testhost.create()
     testhost.ensure_missing()
 def test_raise_limit_above_and_try_hostname_len_above_limit(self):
     """Raise limit above default and try to create host with hostname
     length above the new-set limit. Should fail"""
     testhost = HostTracker(name=u'testhost',
                            fqdn=u'{}'.format(
                                self.generate_hostname(MAXHOSTNAMELEN * 3)))
     self.modify_config_maxhostname(testhost, MAXHOSTNAMELEN * 2)
     with raises_exact(errors.ValidationError(
             name='hostname',
             error=u'can be at most {} characters'.format(
                 MAXHOSTNAMELEN * 2))):
         testhost.create()
         testhost.ensure_missing()
 def test_try_hostname_length_above_maxhostnamelimit(self):
     """Try to create host with hostname length above
     hostnamelength limit. Should fail"""
     testhost = HostTracker(name=u'testhost',
                            fqdn=u'{}'.format(
                                self.generate_hostname(MAXHOSTNAMELEN + 1)))
     self.modify_config_maxhostname(testhost, MAXHOSTNAMELEN)
     with raises_exact(errors.ValidationError(
             name=u'hostname',
             error=u'can be at most {} characters'.format(
                 MAXHOSTNAMELEN))):
         testhost.create()
         testhost.ensure_missing()