-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
testingTest coverageTest coverage
Description
Description
Missing test coverage for complex inline operations and related object handling.
Missing Inline Tests
-
test_inline_custom_form_validation_errors- Invalid data in inline form -
test_inline_multiple_fk_to_parent_uses_fk_name- Multiple FKs to same parent -
test_inline_ambiguous_parent_fk- Inline without explicit parent FK -
test_inline_create_missing_parent_fk- Missing parent_id in data -
test_inline_extra_fields_handling- Extra fields outside model -
test_inline_delete_with_cascade- Delete inline with children -
test_inline_permission_check_per_operation- Different permissions for create/update/delete
Missing Related Object Tests
-
test_related_empty_reverse_accessor- Reverse relation with no items -
test_related_fk_target_deleted- FK target deleted after creation -
test_related_m2m_with_through_model- Complex M2M relationships -
test_related_with_custom_manager_queryset- Custom get_queryset() -
test_related_m2m_pagination- Offset/limit on M2M relations
Missing Bulk Tests
-
test_bulk_create_all_same_fk_parent- Batch FK assignment -
test_bulk_update_different_fields_per_item- Partial field updates -
test_bulk_with_readonly_fields- Readonly fields in bulk format -
test_bulk_delete_with_cascade_effects- Cascade behavior
Example Test
@pytest.mark.django_db
@pytest.mark.asyncio
async def test_inline_permission_check(author, token_change_author_only, async_client):
"""Verify inline create requires add permission on inline model."""
response = await async_client.post(
"/mcp/",
json={
"method": "tools/call",
"params": {
"name": "update_author",
"arguments": {
"id": author.id,
"data": {"name": "Updated"},
"inlines": {
"articles": [
{"title": "New Article", "content": "..."}
]
}
}
}
},
headers={"Authorization": f"Bearer {token_change_author_only.token}"}
)
data = response.json()
# Should fail because token doesn't have add_article permission
assert "permission_denied" in str(data) or "error" in dataReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testingTest coverageTest coverage