@@ -19,7 +19,10 @@ class Test_Blob(unittest2.TestCase):
1919
2020 def _makeOne (self , * args , ** kw ):
2121 from gcloud .storage .blob import Blob
22- return Blob (* args , ** kw )
22+ properties = kw .pop ('properties' , None )
23+ blob = Blob (* args , ** kw )
24+ blob ._properties = properties or {}
25+ return blob
2326
2427 def test_ctor_no_bucket (self ):
2528 self .assertRaises (ValueError , self ._makeOne , None )
@@ -63,29 +66,6 @@ def test_ctor_explicit(self):
6366 self .assertEqual (blob .properties , properties )
6467 self .assertTrue (blob ._acl is None )
6568
66- def test_ctor_no_name_defaults (self ):
67- BLOB_NAME = 'blob-name'
68- properties = {'key' : 'value' , 'name' : BLOB_NAME }
69- FAKE_BUCKET = _Bucket (None )
70- blob = self ._makeOne (None , bucket = FAKE_BUCKET , properties = properties )
71- self .assertEqual (blob .bucket , FAKE_BUCKET )
72- self .assertEqual (blob .connection , None )
73- self .assertEqual (blob .name , BLOB_NAME )
74- self .assertEqual (blob .properties , properties )
75- self .assertTrue (blob ._acl is None )
76-
77- def test_ctor_no_name_explicit (self ):
78- BLOB_NAME = 'blob-name'
79- connection = _Connection ()
80- bucket = _Bucket (connection )
81- properties = {'key' : 'value' , 'name' : BLOB_NAME }
82- blob = self ._makeOne (None , properties = properties , bucket = bucket )
83- self .assertTrue (blob .bucket is bucket )
84- self .assertTrue (blob .connection is connection )
85- self .assertEqual (blob .name , BLOB_NAME )
86- self .assertEqual (blob .properties , properties )
87- self .assertTrue (blob ._acl is None )
88-
8969 def test_acl_property (self ):
9070 from gcloud .storage .acl import ObjectACL
9171 FAKE_BUCKET = _Bucket (None )
@@ -1043,8 +1023,7 @@ def __init__(self, connection):
10431023
10441024 def copy_blob (self , blob , destination_bucket , new_name ):
10451025 destination_bucket ._blobs [new_name ] = self ._blobs [blob .name ]
1046- return blob .__class__ (None , bucket = destination_bucket ,
1047- properties = {'name' : new_name })
1026+ return blob .__class__ (new_name , bucket = destination_bucket )
10481027
10491028 def delete_blob (self , blob_name ):
10501029 del self ._blobs [blob_name ]
0 commit comments