@@ -105,7 +105,7 @@ def test_update_activity_multiple_fields():
105105
106106
107107def test_update_activity_api_failure ():
108- """Test handling of API failure during update."""
108+ """Test that API failure during update raises the exception ."""
109109 provider = RideWithGPSProvider ()
110110
111111 # Mock API failure
@@ -114,18 +114,16 @@ def test_update_activity_api_failure():
114114 # Test data
115115 activity_data = {"ridewithgps_id" : "12345" , "name" : "Updated Name" }
116116
117- # Call update_activity and expect it to handle the exception
118- result = provider .update_activity (activity_data )
119-
120- # Verify the result is False due to the exception
121- assert result is False
117+ # update_activity should raise so callers get the real error message
118+ with pytest .raises (Exception , match = "API Error" ):
119+ provider .update_activity (activity_data )
122120
123121 # Verify the API was called
124122 provider .client .patch .assert_called_once ()
125123
126124
127125def test_update_activity_api_error_response ():
128- """Test handling of API error response during update."""
126+ """Test that an API error response during update raises a RuntimeError ."""
129127 provider = RideWithGPSProvider ()
130128
131129 # Mock API response with error
@@ -135,11 +133,9 @@ def test_update_activity_api_error_response():
135133 # Test data
136134 activity_data = {"ridewithgps_id" : "12345" , "name" : "Updated Name" }
137135
138- # Call update_activity
139- result = provider .update_activity (activity_data )
140-
141- # Verify the result is False due to the error response
142- assert result is False
136+ # update_activity should raise so callers get the real error message
137+ with pytest .raises (RuntimeError , match = "Some API error" ):
138+ provider .update_activity (activity_data )
143139
144140
145141def test_update_activity_removes_provider_id ():
0 commit comments