Revision 7b4126b7 test/ganeti.utils_unittest.py

b/test/ganeti.utils_unittest.py
41 41
     RemoveFile, CheckDict, MatchNameComponent, FormatUnit, \
42 42
     ParseUnit, AddAuthorizedKey, RemoveAuthorizedKey, \
43 43
     ShellQuote, ShellQuoteArgs, TcpPing, ListVisibleFiles, \
44
     SetEtcHostsEntry, RemoveEtcHostsEntry
44
     SetEtcHostsEntry, RemoveEtcHostsEntry, FirstFree
45 45
from ganeti.errors import LockError, UnitParseError
46 46

  
47 47
def _ChildHandler(signal, stack):
......
689 689
    self._test(["a", "b"], ["a", "b"])
690 690
    self._test(["a", "b", "a"], ["a", "b"])
691 691

  
692
class TestFirstFree(unittest.TestCase):
693
  """Test case for the FirstFree function"""
694

  
695
  def test(self):
696
    """Test FirstFree"""
697
    self.failUnlessEqual(FirstFree([0, 1, 3]), 2)
698
    self.failUnlessEqual(FirstFree([]), None)
699
    self.failUnlessEqual(FirstFree([3, 4, 6]), 0)
700
    self.failUnlessEqual(FirstFree([3, 4, 6], base=3), 5)
701
    self.failUnlessRaises(AssertionError, FirstFree, [0, 3, 4, 6], base=3)
692 702

  
693 703
if __name__ == '__main__':
694 704
  unittest.main()

Also available in: Unified diff