@@ -183,6 +183,31 @@ def test_update(self):
183183 # Make sure changes get reset by patch().
184184 self .assertEqual (derived ._changes , set ())
185185
186+ def test_update_w_user_project (self ):
187+ user_project = 'user-project-123'
188+ connection = _Connection ({'foo' : 'Foo' })
189+ client = _Client (connection )
190+ derived = self ._derivedClass ('/path' , user_project )()
191+ # Make sure changes is non-empty, so we can observe a change.
192+ BAR = object ()
193+ BAZ = object ()
194+ derived ._properties = {'bar' : BAR , 'baz' : BAZ }
195+ derived ._changes = set (['bar' ]) # Update sends 'baz' anyway.
196+ derived .update (client = client )
197+ self .assertEqual (derived ._properties , {'foo' : 'Foo' })
198+ kw = connection ._requested
199+ self .assertEqual (len (kw ), 1 )
200+ self .assertEqual (kw [0 ]['method' ], 'PUT' )
201+ self .assertEqual (kw [0 ]['path' ], '/path' )
202+ self .assertEqual (
203+ kw [0 ]['query_params' ], {
204+ 'projection' : 'full' ,
205+ 'userProject' : user_project ,
206+ })
207+ self .assertEqual (kw [0 ]['data' ], {'bar' : BAR , 'baz' : BAZ })
208+ # Make sure changes get reset by patch().
209+ self .assertEqual (derived ._changes , set ())
210+
186211
187212class Test__scalar_property (unittest .TestCase ):
188213
0 commit comments