From 6de6dc72c659f17fec8fb3a5c97f45c7db4c6622 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Sat, 12 Nov 2005 01:10:41 +0000 Subject: [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-80] add 'x' flag to open to allow O_EXCL behavior --- tests/test_sftp.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 94e9dea5..3372e8f8 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -670,3 +670,19 @@ class SFTPTest (unittest.TestCase): paramiko.util.hexify(sum)) finally: sftp.unlink(FOLDER + '/kitty.txt') + + def test_N_x_flag(self): + """ + verify that the 'x' flag works when opening a file. + """ + f = sftp.open(FOLDER + '/unusual.txt', 'wx') + f.close() + + try: + try: + f = sftp.open(FOLDER + '/unusual.txt', 'wx') + self.fail('expected exception') + except IOError, x: + pass + finally: + sftp.unlink(FOLDER + '/unusual.txt') -- cgit v1.2.3