From: Tim Beale Date: Tue, 4 Dec 2018 23:51:22 +0000 (+1300) Subject: tests: Extend SMB test_save_load_text case to check overwrite X-Git-Tag: tdb-1.3.17~361 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da30c824b8240e92ad4bcdcd174d56c39235412e;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett --- 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): diff --git a/selftest/knownfail.d/smb b/selftest/knownfail.d/smb new file mode 100644 index 00000000000..32989a81374 --- /dev/null +++ b/selftest/knownfail.d/smb @@ -0,0 +1,3 @@ +# currently savefile appends rather than overwriting +samba.tests.smb.samba.tests.smb.SMBTests.test_save_load_text\(ad_dc:local\) +samba.tests.smb.python2.samba.tests.smb.SMBTests.test_save_load_text\(ad_dc:local\)