Opened 7 years ago
Closed 7 years ago
#30359 closed Bug (invalid)
Possible access to unintended variable in "django/tests/contenttypes_tests/test_models.py" line 128
| Reported by: | Petru-Florin Mihancea | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.contenttypes | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file "django/tests/contenttypes_tests/test_models.py" line 128 function test_get_for_concrete_model.
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(DeferredProxyModel)) <<<<<<HERE
self.assertEqual(
proxy_model_ct,
ContentType.objects.get_for_model(DeferredProxyModel, for_concrete_model=False)
Shouldn't you use proxy_model_ct instead of concrete_model_ct in the first line (as it is used in the second)?
Thanks,
Petru-Florin Mihancea
Change History (1)
comment:1 by , 7 years ago
| Component: | Uncategorized → contrib.contenttypes |
|---|---|
| Description: | modified (diff) |
| Resolution: | → invalid |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The test doesn't pass with that change.
ContentType.objects.get_for_model()defaults tofor_concrete_model=Trueso the behavior looks correct.