From: Yehuda Sadeh Date: Wed, 16 May 2012 20:30:39 +0000 (-0700) Subject: test_s3: fix FakeFile.seek(): handles whence param X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=adabd0ba7def8fc12e00b2c19a37d5936d53eff6;p=s3-tests.git test_s3: fix FakeFile.seek(): handles whence param beforehand we didn't accept the seek() whence param, which failed with boto 2.4.0. Signed-off-by: Yehuda Sadeh --- diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py index 99b49aa7..419dfe84 100644 --- a/s3tests/functional/test_s3.py +++ b/s3tests/functional/test_s3.py @@ -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