summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-12-05 12:51:22 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-12-12 04:38:13 +0100
commitda30c824b8240e92ad4bcdcd174d56c39235412e (patch)
treeac72bdb80954f8b4ee7c0725f0a7fd9867be4703 /python
parent629a41fc6542cda9c2d60f99e8d7856aa1e081e5 (diff)
downloadsamba-da30c824b8240e92ad4bcdcd174d56c39235412e.tar.gz
tests: Extend SMB test_save_load_text case to check overwrite
Extend the test case to check overwriting a file as well. Currently this has the behaviour of appending to the existing file, rather than overwriting the file with new contents. It's not clear from the API that this is the intended behaviour in this case, so I've marked it as a failure. 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/smb.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/samba/tests/smb.py b/python/samba/tests/smb.py
index 70d6cd8ef2d..e3af777ab77 100644
--- a/python/samba/tests/smb.py
+++ b/python/samba/tests/smb.py
@@ -134,6 +134,13 @@ class SMBTests(samba.tests.TestCase):
self.assertEquals(contents.decode('utf8'), test_contents,
msg='contents of test file did not match what was written')
+ # check we can overwrite the file with new contents
+ new_contents = 'wxyz' * 128
+ self.conn.savefile(test_file, new_contents.encode('utf8'))
+ contents = self.conn.loadfile(test_file)
+ self.assertEquals(contents.decode('utf8'), new_contents,
+ msg='contents of test file did not match what was written')
+
# with python2 this will save/load str type (with embedded nulls)
# with python3 this will save/load bytes type
def test_save_load_string_bytes(self):