Skip to content
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

[#3889] Improve timeline logs admin #4086

Merged
merged 12 commits into from
Apr 9, 2024
Merged

[#3889] Improve timeline logs admin #4086

merged 12 commits into from
Apr 9, 2024

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Apr 2, 2024

Fixes #3889

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.10%. Comparing base (cb2960c) to head (ae56b09).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4086   +/-   ##
=======================================
  Coverage   96.10%   96.10%           
=======================================
  Files         730      730           
  Lines       23085    23130   +45     
  Branches     2698     2701    +3     
=======================================
+ Hits        22185    22230   +45     
  Misses        638      638           
  Partials      262      262           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Viicos Viicos changed the title [#3889] Add admin list filters for logs [#3889] Improve timeline logs admin Apr 3, 2024
@Viicos Viicos marked this pull request as ready for review April 3, 2024 15:28
src/openforms/logging/models.py Outdated Show resolved Hide resolved
Comment on lines 57 to 64
self.assertEqual(
[
option
for option in html_form.fields.get("action")[0].options
if option[0] == "delete_selected"
],
[],
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just assert what is present?

options = {value for value, *_ in html_form.fields.get("action")[0].options}
self.assertEqual(options, {"_export"})  # or whatever the relevant value is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is originally to assert that you can't delete records. With your assertion suggestion the test would break whenever a new action gets added? Probably not going happen anyway 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah and if the value of the action option in django changes, your version will break and be harder to debug, while this proposed change is a lot more readable and obvious

the previous test assertion worked because it checked that the action dropdown as a whole is absent :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well same can happen if django-import-export changes the name of the action as well 😄 but this would be a straightforward test update anyway

src/openforms/logging/tests/test_admin.py Outdated Show resolved Hide resolved
src/openforms/utils/admin.py Show resolved Hide resolved
@Viicos Viicos force-pushed the feature/3889 branch 6 times, most recently from fb82f6a to 6164956 Compare April 5, 2024 13:54
@sergei-maertens sergei-maertens force-pushed the feature/3889 branch 2 times, most recently from 93dcda1 to dc18dc1 Compare April 8, 2024 15:37
@sergei-maertens sergei-maertens merged commit a709ac9 into master Apr 9, 2024
27 checks passed
@sergei-maertens sergei-maertens deleted the feature/3889 branch April 9, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As Privacy/Security Officer I want to see and export log entries in a certain period
2 participants