From feadfc41a1f1223d59c8c0e9427d6a8bdb9a5e94 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Fri, 22 Jan 2016 11:35:03 +1300 Subject: CVE-2016-0771: tests: rename test getopt to get_opt This avoids any conflicts in this directory with the original toplevel getopt. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11128 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11686 Signed-off-by: Garming Sam Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- python/samba/tests/get_opt.py | 55 +++++++++++++++++++++++++++++++++++++++++++ python/samba/tests/getopt.py | 55 ------------------------------------------- selftest/tests.py | 2 +- 3 files changed, 56 insertions(+), 56 deletions(-) create mode 100644 python/samba/tests/get_opt.py delete mode 100644 python/samba/tests/getopt.py diff --git a/python/samba/tests/get_opt.py b/python/samba/tests/get_opt.py new file mode 100644 index 00000000000..14ee0a7428b --- /dev/null +++ b/python/samba/tests/get_opt.py @@ -0,0 +1,55 @@ +# Unix SMB/CIFS implementation. +# Copyright (C) Jelmer Vernooij 2011 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +"""Tests for option parsing. + +""" + +import optparse +from samba.getopt import ( + AUTO_USE_KERBEROS, + DONT_USE_KERBEROS, + MUST_USE_KERBEROS, + parse_kerberos_arg, + ) +import samba.tests + +class KerberosOptionTests(samba.tests.TestCase): + + def test_parse_true(self): + self.assertEquals( + MUST_USE_KERBEROS, parse_kerberos_arg("yes", "--kerberos")) + self.assertEquals( + MUST_USE_KERBEROS, parse_kerberos_arg("true", "--kerberos")) + self.assertEquals( + MUST_USE_KERBEROS, parse_kerberos_arg("1", "--kerberos")) + + def test_parse_false(self): + self.assertEquals( + DONT_USE_KERBEROS, parse_kerberos_arg("no", "--kerberos")) + self.assertEquals( + DONT_USE_KERBEROS, parse_kerberos_arg("false", "--kerberos")) + self.assertEquals( + DONT_USE_KERBEROS, parse_kerberos_arg("0", "--kerberos")) + + def test_parse_auto(self): + self.assertEquals( + AUTO_USE_KERBEROS, parse_kerberos_arg("auto", "--kerberos")) + + def test_parse_invalid(self): + self.assertRaises(optparse.OptionValueError, + parse_kerberos_arg, "blah?", "--kerberos") diff --git a/python/samba/tests/getopt.py b/python/samba/tests/getopt.py deleted file mode 100644 index 14ee0a7428b..00000000000 --- a/python/samba/tests/getopt.py +++ /dev/null @@ -1,55 +0,0 @@ -# Unix SMB/CIFS implementation. -# Copyright (C) Jelmer Vernooij 2011 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -"""Tests for option parsing. - -""" - -import optparse -from samba.getopt import ( - AUTO_USE_KERBEROS, - DONT_USE_KERBEROS, - MUST_USE_KERBEROS, - parse_kerberos_arg, - ) -import samba.tests - -class KerberosOptionTests(samba.tests.TestCase): - - def test_parse_true(self): - self.assertEquals( - MUST_USE_KERBEROS, parse_kerberos_arg("yes", "--kerberos")) - self.assertEquals( - MUST_USE_KERBEROS, parse_kerberos_arg("true", "--kerberos")) - self.assertEquals( - MUST_USE_KERBEROS, parse_kerberos_arg("1", "--kerberos")) - - def test_parse_false(self): - self.assertEquals( - DONT_USE_KERBEROS, parse_kerberos_arg("no", "--kerberos")) - self.assertEquals( - DONT_USE_KERBEROS, parse_kerberos_arg("false", "--kerberos")) - self.assertEquals( - DONT_USE_KERBEROS, parse_kerberos_arg("0", "--kerberos")) - - def test_parse_auto(self): - self.assertEquals( - AUTO_USE_KERBEROS, parse_kerberos_arg("auto", "--kerberos")) - - def test_parse_invalid(self): - self.assertRaises(optparse.OptionValueError, - parse_kerberos_arg, "blah?", "--kerberos") diff --git a/selftest/tests.py b/selftest/tests.py index 88a08c9724d..a3806ed4069 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -43,7 +43,7 @@ planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests planpythontestsuite("none", "samba.tests.credentials") planpythontestsuite("none", "samba.tests.registry") planpythontestsuite("none", "samba.tests.auth") -planpythontestsuite("none", "samba.tests.getopt") +planpythontestsuite("none", "samba.tests.get_opt") planpythontestsuite("none", "samba.tests.security") planpythontestsuite("none", "samba.tests.dcerpc.misc") planpythontestsuite("none", "samba.tests.param") -- cgit v1.2.1