]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
test_s3: fix FakeFile.seek(): handles whence param
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 16 May 2012 20:30:39 +0000 (13:30 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 16 May 2012 20:32:20 +0000 (13:32 -0700)
beforehand we didn't accept the seek() whence param, which
failed with boto 2.4.0.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
s3tests/functional/test_s3.py

index 99b49aa7d607bafc8cea885f17ead50e31103006..419dfe8418f70742a132b2d452909378a5f1a1a5 100644 (file)
@@ -12,6 +12,7 @@ import random
 import string
 import socket
 import ssl
+import os
 
 from httplib import HTTPConnection, HTTPSConnection
 from urlparse import urlparse
@@ -2938,8 +2939,13 @@ class FakeFile(object):
         self.char = char
         self.interrupt = interrupt
 
-    def seek(self, offset):
-        self.offset = offset
+    def seek(self, offset, whence=os.SEEK_SET):
+        if whence == os.SEEK_SET:
+            self.offset = offset
+        elif whence == os.SEEK_END:
+            self.offset = self.size + offset;
+        elif whence == os.SEEK_CUR:
+            self.offset += offset
 
     def tell(self):
         return self.offset