1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

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 <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Tim Beale 2018-11-22 14:35:58 +13:00 committed by Tim Beale
parent 160031f7b7
commit 93c2a95223

View File

@ -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()