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 <yehuda@inktank.com>
This commit is contained in:
Yehuda Sadeh 2012-05-16 13:30:39 -07:00
parent ebbafdb3e8
commit adabd0ba7d

View file

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