Add new RHEL7 logvol objects to master
[pykickstart.git] / tests / commands / timezone.py
blob8ee9cd3b078027932a20689fa588231450253329
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2009 Red Hat, Inc.
6 # This copyrighted material is made available to anyone wishing to use, modify,
7 # copy, or redistribute it subject to the terms and conditions of the GNU
8 # General Public License v.2. This program is distributed in the hope that it
9 # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
10 # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # this program; if not, write to the Free Software Foundation, Inc., 51
15 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
16 # trademarks that are incorporated in the source code or documentation are not
17 # subject to the GNU General Public License and may only be used or replicated
18 # with the express permission of Red Hat, Inc.
20 import unittest
21 from tests.baseclass import *
23 from pykickstart.errors import *
25 class FC3_TestCase(CommandTest):
26 command = "timezone"
28 def runTest(self):
29 # pass
30 self.assert_parse("timezone Eastern", "timezone Eastern\n")
32 # On FC6 and later, we write out --isUtc regardless of what the input was.
33 if self.__class__.__name__ == "FC3_TestCase":
34 self.assert_parse("timezone --utc Eastern", "timezone --utc Eastern\n")
35 else:
36 self.assert_parse("timezone --utc Eastern", "timezone --isUtc Eastern\n")
38 # fail
39 self.assert_parse_error("timezone", KickstartValueError)
40 self.assert_parse_error("timezone Eastern Central", KickstartValueError)
41 self.assert_parse_error("timezone --blah Eastern")
42 self.assert_parse_error("timezone --utc", KickstartValueError)
44 class FC6_TestCase(FC3_TestCase):
45 def runTest(self):
46 FC3_TestCase.runTest(self)
48 # pass
49 self.assert_parse("timezone --isUtc Eastern", "timezone --isUtc Eastern\n")
51 # fail
52 self.assert_parse_error("timezone --isUtc", KickstartValueError)
54 class F18_TestCase(FC6_TestCase):
55 def runTest(self):
56 # pass
57 self.assert_parse("timezone --utc Europe/Prague")
58 self.assert_parse("timezone --isUtc Europe/Prague\n")
59 self.assert_parse("timezone --isUtc Eastern", "timezone Eastern --isUtc\n")
60 self.assert_parse("timezone Europe/Prague")
61 self.assert_parse("timezone Europe/Prague --nontp",
62 "timezone Europe/Prague --nontp\n")
63 self.assert_parse("timezone Europe/Prague "\
64 "--ntpservers=ntp.cesnet.cz,tik.nic.cz")
65 self.assert_parse("timezone Europe/Prague --ntpservers=ntp.cesnet.cz,",
66 "timezone Europe/Prague --ntpservers=ntp.cesnet.cz\n")
68 # fail
69 self.assert_parse_error("timezone", KickstartValueError)
70 self.assert_parse_error("timezone Eastern Central", KickstartValueError)
71 self.assert_parse_error("timezone --blah Eastern")
72 self.assert_parse_error("timezone --utc", KickstartValueError)
73 self.assert_parse_error("timezone --isUtc", KickstartValueError)
74 self.assert_parse_error("timezone Europe/Prague --nontp "\
75 "--ntpservers=ntp.cesnet.cz",
76 KickstartParseError)
77 self.assert_parse_error("timezone Europe/Prague --ntpservers="\
78 "ntp.cesnet.cz, tik.nic.cz",
79 KickstartValueError)
81 if __name__ == "__main__":
82 unittest.main()