@@ -687,6 +687,20 @@ def test_update_entity_with_patch_method_specified(service):
687687 query = service .entity_sets .TemperatureMeasurements .update_entity (key , method = "PATCH" )
688688 assert query .get_method () == "PATCH"
689689
690+ def test_update_entity_with_merge_method_specified (service ):
691+ """Make sure the method update_entity handles correctly when MERGE method is specified"""
692+
693+ # pylint: disable=redefined-outer-name
694+
695+
696+ key = EntityKey (
697+ service .schema .entity_type ('TemperatureMeasurement' ),
698+ Sensor = 'sensor1' ,
699+ Date = datetime .datetime (2017 , 12 , 24 , 18 , 0 ))
700+
701+ query = service .entity_sets .TemperatureMeasurements .update_entity (key , method = 'merge' )
702+ assert query .get_method () == 'MERGE'
703+
690704
691705def test_update_entity_with_no_method_specified (service ):
692706 """Make sure the method update_entity handles correctly when no method is specified"""
@@ -730,8 +744,10 @@ def test_update_entity_with_wrong_method_specified(service):
730744 Sensor = 'sensor1' ,
731745 Date = datetime .datetime (2017 , 12 , 24 , 18 , 0 ))
732746
733- with pytest .raises (ValueError ):
734- service .entity_sets .TemperatureMeasurements .update_entity (key , method = "DELETE" )
747+ with pytest .raises (ValueError ) as caught_ex :
748+ service .entity_sets .TemperatureMeasurements .update_entity (key , method = 'DELETE' )
749+
750+ assert str (caught_ex .value ).startswith ('The value "DELETE" is not on the list of allowed Entity Update HTTP Methods: PATCH, PUT, MERGE' )
735751
736752
737753def test_get_entity_with_entity_key_and_other_params (service ):
0 commit comments