2 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2010
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 from buildfarm import util
25 class DhmTimeTests(unittest.TestCase):
27 def test_simple(self):
28 self.assertEquals("0s", util.dhm_time(0))
29 self.assertEquals("1m", util.dhm_time(61))
30 self.assertEquals("-", util.dhm_time(-20))
31 self.assertEquals("1d 3h 1m", util.dhm_time(97265))
32 self.assertEquals("3h 1m", util.dhm_time(10865))
35 class LoadTests(testtools.TestCase):
37 def test_simple(self):
38 fd, name = tempfile.mkstemp()
39 self.addCleanup(os.remove, name)
40 f = os.fdopen(fd, 'w')
48 l = util.load_list(name)
49 self.assertEquals(4, len(l))
50 self.assertEquals("three", l[2])