Add new RHEL7 logvol objects to master
[pykickstart.git] / tests / commands / keyboard.py
blob390cdb4e5a1ea492432ec6f5f6fb93ba655e3d03
2 # Paul W. Frields <pfrields@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 *
24 from pykickstart.commands.keyboard import *
26 class FC3_TestCase(CommandTest):
27 command = "keyboard"
29 def runTest(self):
30 # pass
31 self.assert_parse("keyboard us", "keyboard us\n")
33 # fail
34 self.assert_parse_error("keyboard", KickstartValueError)
35 self.assert_parse_error("keyboard us uk", KickstartValueError)
36 self.assert_parse_error("keyboard --foo us", KickstartParseError)
38 class F18_TestCase(FC3_TestCase):
39 command = "keyboard"
41 def runTest(self):
42 # pass
43 self.assert_parse("keyboard us",
44 "keyboard 'us'\n")
45 self.assert_parse("keyboard --vckeymap=us",
46 "keyboard --vckeymap=us\n")
47 # This is tedious - I'm only going to check it once.
48 self.assert_parse("keyboard --vckeymap=us sk",
49 "# old format: keyboard sk\n# new format:\nkeyboard --vckeymap=us\n")
50 self.assert_parse("keyboard --xlayouts='cz (qwerty)'",
51 "keyboard --xlayouts='cz (qwerty)'\n")
52 self.assert_parse("keyboard --xlayouts=cz,'cz (qwerty)'",
53 "keyboard --xlayouts='cz','cz (qwerty)'\n")
54 self.assert_parse("keyboard --xlayouts=cz sk")
55 self.assert_parse("keyboard --vckeymap=us --xlayouts=cz",
56 "keyboard --vckeymap=us --xlayouts='cz'\n")
57 self.assert_parse("keyboard --vckeymap=us --xlayouts=cz,'cz (qwerty)' sk")
58 self.assert_parse("keyboard --vckeymap=us --xlayouts=cz --switch=grp:alt_shift_toggle",
59 "keyboard --vckeymap=us --xlayouts='cz' --switch='grp:alt_shift_toggle'\n")
60 self.assert_parse("keyboard --vckeymap=us --xlayouts=cz --switch=grp:alt_shift_toggle,grp:switch",
61 "keyboard --vckeymap=us --xlayouts='cz' --switch='grp:alt_shift_toggle','grp:switch'\n")
63 # fail
64 self.assert_parse_error("keyboard", KickstartValueError)
65 self.assert_parse_error("keyboard cz sk", KickstartValueError)
66 self.assert_parse_error("keyboard --vckeymap=us --xlayouts=cz,"
67 "'cz (qwerty)' cz sk", KickstartValueError)
68 self.assert_parse_error("keyboard --foo us", KickstartParseError)
70 # keyboard property
71 obj = self.assert_parse("keyboard us")
72 self.assertEqual(obj.keyboard, "us")
74 obj = self.assert_parse("keyboard --xlayouts=us,cz")
75 self.assertEqual(obj.keyboard, "us")
77 obj.keyboard = "cz"
78 self.assertEqual(obj.keyboard, "cz")
80 if __name__ == "__main__":
81 unittest.main()