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

[#2863] When retrieving eHerkenning-cases, filter on either vestigingsnummer or rsin/kvk, but not both #1488

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

alextreme
Copy link
Member

No description provided.

@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch 2 times, most recently from 67e7e1c to eab2d78 Compare November 7, 2024 09:24
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.29%. Comparing base (5e660ba) to head (74d168e).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
src/open_inwoner/cms/cases/views/mixins.py 92.30% 1 Missing ⚠️
src/open_inwoner/openzaak/clients.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1488   +/-   ##
========================================
  Coverage    94.29%   94.29%           
========================================
  Files         1066     1066           
  Lines        40141    40185   +44     
========================================
+ Hits         37849    37894   +45     
+ Misses        2292     2291    -1     

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

@alextreme alextreme marked this pull request as draft November 7, 2024 11:04
@alextreme
Copy link
Member Author

Waiting until I can conform this works as expected

@alextreme alextreme marked this pull request as ready for review November 7, 2024 11:29
@alextreme
Copy link
Member Author

Confirmed to be working for Venray, to be double-checked by both @pi-sigma and @swrichards

Copy link
Contributor

@pi-sigma pi-sigma left a comment

Choose a reason for hiding this comment

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

Looking good. The vestigingsnummer is validated in the CompanyBranchChoiceForm to correspond to one of the branches retrieved from the KVK API. The logic for retrieval/validation of vestigingsnummer will have to be adapted when when we support eHerkenning login scoped to a vestigingsnummer.

@alextreme alextreme marked this pull request as draft November 12, 2024 10:29
@alextreme
Copy link
Member Author

Converting to a draft PR, as when clicking through the user gets a 403

@alextreme alextreme removed the request for review from swrichards November 12, 2024 16:56
@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch 2 times, most recently from b2b571c to 5b268e3 Compare November 12, 2024 16:58
@alextreme alextreme requested a review from pi-sigma November 12, 2024 16:58
@alextreme
Copy link
Member Author

@pi-sigma FYI my first approach was too simplistic, in that retrieval using vestigingnummer is also done within the openzaak app. A few tests still fail but I'm not sure if this is due to having to update the mocks or that my approach is incorrect.

@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch from 5b268e3 to 5e69cac Compare November 12, 2024 17:08
@pi-sigma pi-sigma force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch from 5e69cac to db46c84 Compare November 13, 2024 16:05
@pi-sigma
Copy link
Contributor

@alextreme The test for retrieving cases with vestigingsnummer failed because the value of fetch_cases_for_company is cached and the cache is not cleared between subsequent subtest runs, which resulted in cache hits because we're no longer supplying kvk or rsin. I decided to break up the test into two separate tests. This means code duplication, but I'd rather deal with this than investigating the caching mechanism + subtest behavior every time something goes wrong.

@alextreme
Copy link
Member Author

@swrichards FYI, and I'm starting to agree with Paul's opinion that subtests are making debugging failing tests quite a bit more complicated (in this case it was anything but obvious why a test is failing from the Github actions output), we may need to re-evaluate using them. But because of this please do a double-check

@alextreme alextreme marked this pull request as ready for review November 13, 2024 16:55
@alextreme alextreme requested a review from swrichards November 13, 2024 16:55
@swrichards
Copy link
Collaborator

@swrichards FYI, and I'm starting to agree with Paul's opinion that subtests are making debugging failing tests quite a bit more complicated (in this case it was anything but obvious why a test is failing from the Github actions output), we may need to re-evaluate using them. But because of this please do a double-check

I think parametrized tests are a very valuable pattern that improves test readability and coverage, but at the same time, I Agree subTest is often more trouble than it's worth as it does not provide full test isolation (see elsewhere mocks, Django messages, etc. which are not properly cleared). For this reason I would prefer pytest which has first-class support for test parametrization, among other nice things, but that's another discussion for another time. TLDR: let's avoid subTest for anything that involves Django components or complex mocks (I still think it's fine for simple unit tests involving pure'ish functions).

@alextreme alextreme marked this pull request as draft November 14, 2024 10:18
@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch 2 times, most recently from 1658eb1 to 4f5cf5d Compare November 15, 2024 20:40
@alextreme
Copy link
Member Author

Did a bit of debugging this evening to figure this out, and noticed that the roles were being checked versus the kvk/rsin via the detail mixin. Also increased the loglevel to info and ensured that the logmessages were distinct from each other to assist in figuring this out quicker next time

@alextreme alextreme marked this pull request as ready for review November 15, 2024 20:43
@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch from 4f5cf5d to 68bd74b Compare November 15, 2024 20:45
@alextreme alextreme force-pushed the issue/2863-filter-eherkenning-cases-or-not-and branch from 68bd74b to 74d168e Compare November 16, 2024 13:37
@alextreme alextreme marked this pull request as draft November 18, 2024 09:12
@alextreme
Copy link
Member Author

To be verified on Venray install just in case

@alextreme alextreme marked this pull request as ready for review November 18, 2024 19:17
@alextreme
Copy link
Member Author

@pi-sigma solution verified to be working on venray testenvironment

@alextreme alextreme merged commit a30a379 into develop Nov 20, 2024
20 checks passed
@alextreme alextreme deleted the issue/2863-filter-eherkenning-cases-or-not-and branch November 20, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants