Make keys pickleable
This commit is contained in:
parent
f15f006f78
commit
191ad6d778
2 changed files with 45 additions and 14 deletions
|
|
@ -8,6 +8,7 @@ from functools import wraps
|
|||
from gzip import GzipFile
|
||||
from io import BytesIO
|
||||
import zlib
|
||||
import pickle
|
||||
|
||||
import json
|
||||
import boto
|
||||
|
|
@ -65,6 +66,16 @@ class MyModel(object):
|
|||
s3.put_object(Bucket='mybucket', Key=self.name, Body=self.value)
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_keys_are_pickleable():
|
||||
"""Keys must be pickleable due to boto3 implementation details."""
|
||||
key = s3model.FakeKey('name', b'data!')
|
||||
pickled = pickle.dumps(key)
|
||||
loaded = pickle.loads(pickled)
|
||||
|
||||
assert loaded.value == key.value
|
||||
|
||||
|
||||
@mock_s3
|
||||
def test_my_model_save():
|
||||
# Create Bucket so that test can run
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue