@@ -53,7 +53,6 @@ def test_batch(self):
5353 derived ._patch_properties ({'foo' : 'Foo' })
5454 derived ._patch_properties ({'bar' : 'Baz' })
5555 derived ._patch_properties ({'foo' : 'Qux' })
56- derived .patch ()
5756 kw = connection ._requested
5857 self .assertEqual (len (kw ), 1 )
5958 self .assertEqual (kw [0 ]['method' ], 'PATCH' )
@@ -97,7 +96,7 @@ def test__patch_properties(self):
9796 self .assertEqual (kw [0 ]['query_params' ], {'projection' : 'full' })
9897
9998
100- class TestPropertyBatch (unittest2 .TestCase ):
99+ class Test_PropertyBatch (unittest2 .TestCase ):
101100
102101 def _getTargetClass (self ):
103102 from gcloud .storage ._helpers import _PropertyBatch
@@ -129,21 +128,11 @@ def test_ctor_does_not_intercept__patch_properties(self):
129128 self .assertEqual (before , after )
130129 self .assertTrue (batch ._wrapped is wrapped )
131130
132- def test_cm_intercepts_restores__patch_properties (self ):
133- wrapped = self ._makeWrapped ()
134- before = wrapped ._patch_properties
135- batch = self ._makeOne (wrapped )
136- with batch :
137- # No deferred patching -> no call to the real '_patch_properties'
138- during = wrapped ._patch_properties
139- after = wrapped ._patch_properties
140- self .assertNotEqual (before , during )
141- self .assertEqual (before , after )
142-
143- def test___exit___w_error_skips__patch_properties (self ):
131+ def test___exit___w_error_skips_patch (self ):
144132 class Testing (Exception ):
145133 pass
146- wrapped = self ._makeWrapped ()
134+ connection = _Connection ()
135+ wrapped = self ._makeWrapped (connection )
147136 batch = self ._makeOne (wrapped )
148137 try :
149138 with batch :
@@ -154,7 +143,10 @@ class Testing(Exception):
154143 except Testing :
155144 pass
156145
157- def test___exit___no_error_aggregates__patch_properties (self ):
146+ kw = connection ._requested
147+ self .assertEqual (len (kw ), 0 )
148+
149+ def test___exit___no_error_calls_patch (self ):
158150 connection = _Connection ({'foo' : 'Foo' })
159151 wrapped = self ._makeWrapped (connection , '/path' )
160152 batch = self ._makeOne (wrapped )
@@ -165,7 +157,6 @@ def test___exit___no_error_aggregates__patch_properties(self):
165157 wrapped ._patch_properties ({'bar' : 'Baz' })
166158 wrapped ._patch_properties ({'foo' : 'Qux' })
167159 self .assertEqual (len (kw ), 0 )
168- wrapped .patch ()
169160 # exited w/o error -> call to the real '_patch_properties'
170161 self .assertEqual (len (kw ), 1 )
171162 self .assertEqual (kw [0 ]['method' ], 'PATCH' )
0 commit comments