Skip to content

Commit 6acae5e

Browse files
tpellissierclaude
andcommitted
Fix test: missing required API fields should raise KeyError
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 960d58e commit 6acae5e

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

tests/unit/models/test_relationship.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@ def test_unknown_type_raises(self):
138138
RelationshipInfo.from_api_response(raw)
139139
self.assertIn("Unrecognized relationship", str(ctx.exception))
140140

141-
def test_missing_fields(self):
142-
"""Should handle missing optional fields without error."""
141+
def test_missing_required_fields_raises(self):
142+
"""Should raise KeyError when required API fields are missing."""
143143
raw = {
144144
"@odata.type": "#Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",
145145
"SchemaName": "minimal",
146146
}
147-
info = RelationshipInfo.from_api_response(raw)
148-
self.assertEqual(info.relationship_type, "one_to_many")
149-
self.assertIsNone(info.relationship_id)
150-
self.assertEqual(info.referenced_entity, "")
147+
with self.assertRaises(KeyError):
148+
RelationshipInfo.from_api_response(raw)
151149

152150

153151
class TestCascadeConfiguration:

0 commit comments

Comments
 (0)