Closed
Conversation
* fix: make direct call to cdn purge --------- Co-authored-by: Ahtesham Quraish <ahtesham.quraish@192.168.10.4>
* switch to new format for resource id * fixing tests * prefer dictionary resource id - fall back to learning_resource_id
935b541 to
bd3f797
Compare
OpenAPI ChangesShow/hide 412 changes: 30 error, 21 warning, 361 info |
| db_index=True, | ||
| choices=((member.name, member.value) for member in LearningResourceType), | ||
| ) | ||
| resource_category = models.CharField(max_length=256) |
There was a problem hiding this comment.
Bug: Direct calls to models.LearningResource.objects.create() in tests are missing the new required resource_category field, which will cause an IntegrityError.
Severity: HIGH
Suggested Fix
Update all direct models.LearningResource.objects.create() calls in the test suite and any other identified locations to include the required resource_category field with an appropriate value. This will ensure the tests pass and align object creation with the new database schema.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: learning_resources/models.py#L487
Potential issue: The new `resource_category` field on the `LearningResource` model is
non-nullable and has no default value after its migration is applied. However, several
tests in `learning_resources/tasks_test.py` create `LearningResource` objects directly
using `models.LearningResource.objects.create()` without providing a value for this new
field. This will cause the database to raise an `IntegrityError` due to a NOT NULL
constraint violation, leading to test failures. This indicates that other non-test code
paths might also be missing this required field.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shankar Ambady
Ahtesham Quraish
Anastasia Beglova