From: Tim Beale Date: Thu, 22 Nov 2018 01:35:58 +0000 (+1300) Subject: tests: Rework backup test_backup_invalid_args test-case X-Git-Tag: tdb-1.3.17~638 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93c2a9522357e7d70d028cbd6bbeda103f40c69e;p=thirdparty%2Fsamba.git tests: Rework backup test_backup_invalid_args test-case self.create_backup() uses self.run_cmd(), which is a wrapper around self.check_output(). Rework the code to call the underlying check_output() function directly instead. The reason we're doing this is we want run_cmd() to catch exceptions and fail the test (i.e. in the next patch). However, we can't do that because this test case relies on receiving the exceptions. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676 Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/domain_backup.py b/python/samba/tests/domain_backup.py index e9fcd31fb25..5b68ea92b5e 100644 --- a/python/samba/tests/domain_backup.py +++ b/python/samba/tests/domain_backup.py @@ -479,14 +479,17 @@ class DomainBackupRename(DomainBackupBase): """Checks that rename commands with invalid args are rejected""" # try a "rename" using the same realm as the DC currently has - self.base_cmd = ["domain", "backup", "rename", self.restore_domain, - os.environ["REALM"]] - self.assertRaises(BlackboxProcessError, self.create_backup) + rename_cmd = "samba-tool domain backup rename " + bad_cmd = "{cmd} {domain} {realm}".format(cmd=rename_cmd, + domain=self.restore_domain, + realm=os.environ["REALM"]) + self.assertRaises(BlackboxProcessError, self.check_output, bad_cmd) # try a "rename" using the same domain as the DC currently has - self.base_cmd = ["domain", "backup", "rename", os.environ["DOMAIN"], - self.restore_realm] - self.assertRaises(BlackboxProcessError, self.create_backup) + bad_cmd = "{cmd} {domain} {realm}".format(cmd=rename_cmd, + domain=os.environ["DOMAIN"], + realm=self.restore_realm) + self.assertRaises(BlackboxProcessError, self.check_output, bad_cmd) def add_link(self, attr, source, target): m = ldb.Message()