summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-11-22 14:35:58 +1300
committerTim Beale <timbeale@samba.org>2018-11-27 03:43:17 +0100
commit93c2a9522357e7d70d028cbd6bbeda103f40c69e (patch)
tree75e376ef5e3833ba26d5fd08cd00341b38fb4e24 /python
parent160031f7b7e4e14a1b9ff9316b166fd52b7d401d (diff)
downloadsamba-93c2a9522357e7d70d028cbd6bbeda103f40c69e.tar.gz
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>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/domain_backup.py15
1 files changed, 9 insertions, 6 deletions
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()