-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce limit on number of tags per object #81
Enforce limit on number of tags per object #81
Conversation
Thanks for the pull request, @rpenido! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
ToDo: bump version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpenido Great work! I just had a few comments on a test case we are missing if you could take a look.
|
||
if current_count >= 100: | ||
raise ValueError( | ||
_(f"Object ({object_id}) already have 100 or more tags.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just a small spelling fix, "already have" -> "already has"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed here:
_(f"Cannot add more than 100 tags to ({object_id}).") |
We are talking about the future state, not the current.
_(f"Object ({object_id}) already have 100 or more tags.") | ||
) | ||
|
||
_check_current_tag_count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check also include the count of the new tags that will will be potentially be added, since this check is happening at the beginning of the function call? Eg: What happens when the current_count
is say 99
but there are 2
new tags in the tags
list leading to 101
, would this check catch it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right @yusuf-musleh! I totally missed the allow_multiple cases.
Thank you for pointing out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 432e4c2
@@ -782,3 +743,21 @@ def test_tag_object_without_permission(self, user_attr, expected_status): | |||
|
|||
response = self.client.put(url, {"tags": ["Tag 1"]}, format="json") | |||
assert response.status_code == expected_status | |||
assert not status.is_success(expected_status) # No success cases here | |||
|
|||
def test_tag_object_count_limit(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would super helpful if we could also add a test case that covers the scenario described above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Thank you!
Done here: 432e4c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for making the changes! Looks good to me, I believe @bradenmacdonald would need to do the final approval/merge for it.
- I tested this: I read through the tests to make sure it covers the cases
- I read through the code
-
I checked for accessibility issues - Includes documentation
-
I made sure any change in configuration variables is reflected in the corresponding client'sconfiguration-secure
repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! And I love the simplification of not needing pagination due to the new rule.
@rpenido 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
This PR enforces a 100 hardcoded limit on the number of ObjectTags applied on any object. It also removes the pagination of the tagging REST API for listing and updating object tags.
Supporting Information
Testing instructions
After merge
v0.1.7
Private-ref: FAL-3501