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.
22 from tests
.baseclass
import *
24 class FC6_TestCase(CommandTest
):
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")
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
)
46 self
.assert_parse_error("iscsi --ipaddr=1.2.3.4 --unknown=value", KickstartParseError
)
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
):
57 FC6_TestCase
.runTest(self
)
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")
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
):
72 F10_TestCase
.runTest(self
)
74 self
.assert_parse("iscsi --ipaddr=1.1.1.1 --iface=eth0\n")
76 if __name__
== "__main__":