@@ -95,6 +95,26 @@ def test_patch(self):
9595 # Make sure changes get reset by patch().
9696 self .assertEqual (derived ._changes , set ())
9797
98+ def test_update (self ):
99+ connection = _Connection ({'foo' : 'Foo' })
100+ client = _Client (connection )
101+ derived = self ._derivedClass ('/path' )()
102+ # Make sure changes is non-empty, so we can observe a change.
103+ BAR = object ()
104+ BAZ = object ()
105+ derived ._properties = {'bar' : BAR , 'baz' : BAZ }
106+ derived ._changes = set (['bar' ]) # Update sends 'baz' anyway.
107+ derived .update (client = client )
108+ self .assertEqual (derived ._properties , {'foo' : 'Foo' })
109+ kw = connection ._requested
110+ self .assertEqual (len (kw ), 1 )
111+ self .assertEqual (kw [0 ]['method' ], 'PUT' )
112+ self .assertEqual (kw [0 ]['path' ], '/path' )
113+ self .assertEqual (kw [0 ]['query_params' ], {'projection' : 'full' })
114+ self .assertEqual (kw [0 ]['data' ], {'bar' : BAR , 'baz' : BAZ })
115+ # Make sure changes get reset by patch().
116+ self .assertEqual (derived ._changes , set ())
117+
98118
99119class Test__scalar_property (unittest .TestCase ):
100120
0 commit comments