Add new RHEL7 logvol objects to master
[pykickstart.git] / tests / commands / iscsi.py
blobe30191ba7f6301ca3e5aae943fa0be45db11dece
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 FC6_TestCase(CommandTest):
25 command = "iscsi"
27 def runTest(self):
28 # pass
29 self.assert_parse("iscsi --ipaddr=1.1.1.1", "iscsi --ipaddr=1.1.1.1\n")
30 self.assert_parse("iscsi --ipaddr=1.1.1.1 --target=tar --port=1234 --user=name --password=secret",
31 "iscsi --target=tar --ipaddr=1.1.1.1 --port=1234 --user=name --password=secret\n")
32 self.assert_parse("iscsi --ipaddr=1.1.1.1 --target=tar", "iscsi --target=tar --ipaddr=1.1.1.1\n")
33 self.assert_parse("iscsi --ipaddr=1.1.1.1 --port=1234", "iscsi --ipaddr=1.1.1.1 --port=1234\n")
34 self.assert_parse("iscsi --ipaddr=1.1.1.1 --user=name", "iscsi --ipaddr=1.1.1.1 --user=name\n")
35 self.assert_parse("iscsi --ipaddr=1.1.1.1 --password=secret", "iscsi --ipaddr=1.1.1.1 --password=secret\n")
37 # fail
38 # missing required option --ipaddr
39 self.assert_parse_error("iscsi", KickstartValueError)
40 self.assert_parse_error("iscsi --target=tar --user=name --password=secret --port=1234", KickstartValueError)
41 # missing --ipaddr argument
42 self.assert_parse_error("iscsi --ipaddr", KickstartParseError)
43 # unexpected arguments
44 self.assert_parse_error("iscsi --ipaddr=1.2.3.4 not expected", KickstartValueError)
45 # unknown flag
46 self.assert_parse_error("iscsi --ipaddr=1.2.3.4 --unknown=value", KickstartParseError)
47 # empty arguments
48 self.assert_parse_error("iscsi --target --ipaddr=1.2.3.4", KickstartParseError)
49 self.assert_parse_error("iscsi --ipaddr=1.2.3.4 --user", KickstartParseError)
50 self.assert_parse_error("iscsi --ipaddr=1.2.3.4 --password", KickstartParseError)
51 self.assert_parse_error("iscsi --ipaddr=1.2.3.4 --port", KickstartParseError)
54 class F10_TestCase(FC6_TestCase):
55 def runTest(self):
56 # run FC6 test case
57 FC6_TestCase.runTest(self)
59 # pass
60 self.assert_parse("iscsi --ipaddr=1.1.1.1 --reverse-user=name --reverse-password=secret",
61 "iscsi --ipaddr=1.1.1.1 --reverse-user=name --reverse-password=secret\n")
62 self.assert_parse("iscsi --ipaddr=1.1.1.1 --reverse-user=name", "iscsi --ipaddr=1.1.1.1 --reverse-user=name\n")
63 self.assert_parse("iscsi --ipaddr=1.1.1.1 --reverse-password=secret", "iscsi --ipaddr=1.1.1.1 --reverse-password=secret\n")
65 # fail
66 # empty arguments
67 self.assert_parse_error("iscsi --ipaddr=1.1.1.1 --reverse-user", KickstartParseError)
68 self.assert_parse_error("iscsi --ipaddr=1.1.1.1 --reverse-password", KickstartParseError)
70 class RHEL6_TestCase(F10_TestCase):
71 def runTest(self):
72 F10_TestCase.runTest(self)
74 self.assert_parse("iscsi --ipaddr=1.1.1.1 --iface=eth0\n")
76 if __name__ == "__main__":
77 unittest.main()