Fix saving status filter by correctly saving preferences#3445
Fix saving status filter by correctly saving preferences#3445lunkwill42 merged 1 commit intoUninett:5.13.xfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 5.13.x #3445 +/- ##
===========================================
+ Coverage 0 60.80% +60.80%
===========================================
Files 0 606 +606
Lines 0 43809 +43809
Branches 0 48 +48
===========================================
+ Hits 0 26638 +26638
- Misses 0 17159 +17159
- Partials 0 12 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8c3eb7d to
56f585b
Compare
lunkwill42
left a comment
There was a problem hiding this comment.
Good stuff, only comment are three apparently non-functional lines
tests/integration/web/status_test.py
Outdated
| def test_get_default_status_filter_should_show_filter_for_encoded_filter( | ||
| client, admin_account | ||
| ): | ||
| datastring = base64.b64encode( | ||
| pickle.dumps( | ||
| { | ||
| "status_filters": "alert_type", | ||
| "alert_type": "linkDegraded", | ||
| "stateless_threshold": "24", | ||
| } | ||
| ) | ||
| ) | ||
| admin_account.preferences[admin_account.PREFERENCE_KEY_STATUS] = datastring | ||
| admin_account.save() | ||
|
|
||
| url = reverse('status2-index') | ||
| response = client.get(url) | ||
| assert response.status_code == 200 | ||
| assert "Alert type" in smart_str(response.content) | ||
| assert "linkDegraded" in smart_str(response.content) |
There was a problem hiding this comment.
Have you verified that this test fails before your patch is added?
Because, I would assume both the "Alert type" and "linkDegraded" strings are always present in the response content of the status page, as part of the hidden form fields.
There was a problem hiding this comment.
Very good point, fixed it now, but needed to rebase, since I made a mess of the commit history when I first thought I would not be able to test it
b3a2502 added encoding status preference pickle The resulting bytes were saved without decoding them to string That lead to the status tool not showing the saved filter The filtering itself still worked since that is done by the frontend
947e86b to
5ac0af1
Compare
|



Scope and purpose
Fixes #3442.
b3a2502 added encoding the status preference pickle. The resulting bytes were saved without decoding them to string. That lead to the status tool not showing the saved filter.
The filtering itself still worked since that is done by the frontend.
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
Added/changed documentation<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.