Validate network interface name when parsing the kickstart (#1081982)
[pykickstart.git] / tests / commands / driverdisk.py
blob6053180e90d6a49b04ed5af8f2ff0456831a08e3
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 *
22 from pykickstart.errors import *
24 class FC3_TestCase(CommandTest):
25 command = "driverdisk"
27 def runTest(self):
28 # pass
29 self.assert_parse("driverdisk /dev/sdb2", "driverdisk /dev/sdb2\n")
30 self.assert_parse("driverdisk --source=http://10.0.0.1/disk.img", "driverdisk --source=http://10.0.0.1/disk.img\n")
32 if "--type" in self.optionList:
33 self.assert_parse("driverdisk /dev/sdb2 --type=vfat", "driverdisk /dev/sdb2 --type=vfat\n")
34 # pass - need separate tests per fstype?
35 self.assert_parse("driverdisk /dev/sdb2 --type=ext2", "driverdisk /dev/sdb2 --type=ext2\n")
36 else:
37 self.assert_parse("driverdisk /dev/sdb2", "driverdisk /dev/sdb2\n")
38 # pass - need separate tests per fstype?
39 self.assert_parse("driverdisk /dev/sdb2", "driverdisk /dev/sdb2\n")
41 # fail - no arguments
42 self.assert_parse_error("driverdisk", KickstartValueError)
43 # fail - spurious argument or extra partition
44 self.assert_parse_error("driverdisk /dev/sdb2 foobar", KickstartValueError)
45 # fail - specifying both partition and source
46 self.assert_parse_error("driverdisk /dev/sdb2 --source=http://10.0.0.1/disk.img", KickstartValueError)
48 class FC4_TestCase(FC3_TestCase):
49 def runTest(self):
50 FC3_TestCase.runTest(self)
52 # pass
53 self.assert_parse("driverdisk --biospart=0x82", "driverdisk --biospart=0x82\n")
54 self.assert_parse("driverdisk --biospart=0x80p1", "driverdisk --biospart=0x80p1\n")
56 # fail - no arguments
57 self.assert_parse_error("driverdisk --biospart", KickstartParseError)
58 # fail - specifying both biospart and partition
59 self.assert_parse_error("driverdisk /dev/sdb2 --biospart=0x82", KickstartValueError)
60 # fail - specifying both biospart and source
61 self.assert_parse_error("driverdisk --source=http://10.0.0.1/disk.img --biospart=0x82", KickstartValueError)
63 class F12_TestCase(FC4_TestCase):
64 def runTest(self):
65 FC4_TestCase.runTest(self)
66 self.assert_deprecated("driverdisk", "--type=ext4")
68 class F14_TestCase(F12_TestCase):
69 def runTest(self):
70 F12_TestCase.runTest(self)
71 self.assert_removed("driverdisk", "--type=ext4")
73 if __name__ == "__main__":
74 unittest.main()