Validate network interface name when parsing the kickstart (#1081982)
[pykickstart.git] / tests / commands / liveimg.py
blobf0771c3b77b177b66e0286a8876e1f3d993f360e
2 # Martin Gracik <mgracik@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.
21 import unittest
22 from tests.baseclass import *
24 class F19_TestCase(CommandTest):
25 def runTest(self):
26 # pass
27 self.assert_parse("liveimg --url=http://someplace/somewhere --proxy=http://wherever/other "
28 "--noverifyssl --checksum=e7a9fe500330a1cae4ca114833bb3df014e6d14e63ea9566896a848f3832d0ba",
29 "liveimg --url=\"http://someplace/somewhere\" --proxy=\"http://wherever/other\" "
30 "--noverifyssl --checksum=\"e7a9fe500330a1cae4ca114833bb3df014e6d14e63ea9566896a848f3832d0ba\"\n")
31 self.assert_parse("liveimg --url=http://someplace/somewhere --proxy=http://wherever/other "
32 "--noverifyssl",
33 "liveimg --url=\"http://someplace/somewhere\" --proxy=\"http://wherever/other\" "
34 "--noverifyssl\n")
35 self.assert_parse("liveimg --url=http://someplace/somewhere --proxy=http://wherever/other ",
36 "liveimg --url=\"http://someplace/somewhere\" --proxy=\"http://wherever/other\"\n")
37 self.assert_parse("liveimg --url=http://someplace/somewhere",
38 "liveimg --url=\"http://someplace/somewhere\"\n")
40 # equality
41 self.assertEqual(self.assert_parse("liveimg --url=http://one"), self.assert_parse("liveimg --url=http://one"))
42 self.assertEqual(self.assert_parse("liveimg --url=http://one --proxy=http://wherever"), self.assert_parse("liveimg --url=http://one --proxy=http://wherever"))
43 self.assertEqual(self.assert_parse("liveimg --url=http://one --noverifyssl"), self.assert_parse("liveimg --url=http://one --noverifyssl"))
44 self.assertEqual(self.assert_parse("liveimg --url=http://one --checksum=deadbeef"), self.assert_parse("liveimg --url=http://one --checksum=deadbeef"))
46 self.assertNotEqual(self.assert_parse("liveimg --url=http://one"), self.assert_parse("liveimg --url=http://two"))
47 self.assertNotEqual(self.assert_parse("liveimg --url=http://one --proxy=http://wherever"), self.assert_parse("liveimg --url=http://two"))
48 self.assertNotEqual(self.assert_parse("liveimg --url=http://one --proxy=http://wherever"), self.assert_parse("liveimg --url=http://one, --proxy=http://somewhere"))
49 self.assertNotEqual(self.assert_parse("liveimg --url=http://one --noverifyssl"), self.assert_parse("liveimg --url=http://one"))
50 self.assertNotEqual(self.assert_parse("liveimg --url=http://one --checksum=deadbeef"), self.assert_parse("liveimg --url=http://one"))
51 self.assertNotEqual(self.assert_parse("liveimg --url=http://one --checksum=deadbeef"), self.assert_parse("liveimg --url=http://one --checksum=abababab"))
53 # fail
54 self.assert_parse_error("liveimg", KickstartValueError)
55 self.assert_parse_error("liveimg --url", KickstartParseError)
56 self.assert_parse_error("liveimg --url=http://someplace/somewhere --proxy", KickstartParseError)
57 self.assert_parse_error("liveimg --proxy=http://someplace/somewhere", KickstartValueError)
58 self.assert_parse_error("liveimg --noverifyssl", KickstartValueError)
59 self.assert_parse_error("liveimg --checksum=e7a9fe500330a1cae4ca114833bb3df014e6d14e63ea9566896a848f3832d0ba", KickstartValueError)
62 if __name__ == "__main__":
63 unittest.main()