@@ -189,19 +189,9 @@ def test_update(self):
189189 datapoint_basis1 .entity_id = None # Ensure this triggers a failure
190190 datapoint_basis1 .entity_type = None # Ensure this triggers a failure
191191 datapoint_basis1 .attribute_name = None # Ensure this triggers a failure
192-
193- # List of forbidden fields that should not be included in the update
194- forbidden_fields = ['object_id' , 'jsonpath' , 'topic' ]
195-
196- # Convert the datapoint object to a dictionary
197- update_data = datapoint_basis .model_dump ()
198-
199- # Remove forbidden fields from the update payload
200- update_data = {key : value for key , value in update_data .items () if key not in forbidden_fields }
201-
202- # Send the update request with the filtered update data
192+ update_data = datapoint_basis1 .model_dump_json ()
203193 response1 = requests .request ("PUT" , settings .GATEWAY_URL + "/data/" + object_id , headers = headers ,
204- data = json . dumps ( update_data ) )
194+ data = update_data )
205195
206196 # Log the request and response for debugging
207197 print (f"Request data for update: { update_data } " )
@@ -210,12 +200,13 @@ def test_update(self):
210200
211201 # Ensure the response indicates failure
212202 self .assertFalse (response1 .ok )
213- self .assertEqual (response1 .status_code , 422 )
203+ self .assertEqual (response1 .status_code , 400 )
214204 self .assertIn ("entity_id, entity_type, and attribute_name cannot be null" , response1 .text )
215205
216- print (f"Datapoint basis: { datapoint_basis } " )
217206 # Perform a valid update with correct entity information
218- datapoint_basis_update = DatapointUpdate (
207+ datapoint_basis_update = Datapoint (
208+ jsonpath = datapoint_basis .jsonpath ,
209+ topic = datapoint_basis .topic ,
219210 entity_id = self .test_entity .id ,
220211 entity_type = self .test_entity .type ,
221212 attribute_name = self .test_entity .get_attribute_names ().pop (),
0 commit comments