This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit)
Related to T3079
Differential D5194
Expose a pytest plugin for swh.auth.keycloak ardumont on Mar 3 2021, 6:50 PM. Authored by
Details
This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079
Diff Detail
Event TimelineComment Actions Build is green Patch application report for D5194 (id=18579)Could not rebase; Attempt merge onto a750b58718... Updating a750b58..9d8e662 Fast-forward MANIFEST.in | 1 + conftest.py | 6 + swh/auth/pytest_plugin.py | 160 ++++++++++++++++++++++++ swh/auth/sample_data.py | 144 +++++++++++++++++++++ swh/auth/tests/conftest.py | 39 ------ swh/auth/tests/sample_data.py | 284 ------------------------------------------ swh/auth/tests/test_auth.py | 86 +++++++------ 7 files changed, 353 insertions(+), 367 deletions(-) create mode 100644 conftest.py create mode 100644 swh/auth/pytest_plugin.py create mode 100644 swh/auth/sample_data.py delete mode 100644 swh/auth/tests/conftest.py delete mode 100644 swh/auth/tests/sample_data.py Changes applied before testcommit 9d8e662302a24a754cbc180d38dfe622a1a42f8f Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth This will be required for module depending on it commit 2d3a37d54c4eff3c1421f2e9b093cf1c6118cdb5 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 17:41:29 2021 +0100 auth: Rework tests logic and add coverage to decode_token endpoint This reworks the tests logic as well to reuse the way web tests are written. This is a first step to actually use the mock class defined here as fixture for future modules which will depend on swh-auth (swh-web-client, swh-web and swh-deposit). Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/5/ for more details. Comment Actions I think you should leave the sample_data module inside the tests folder, create a keycloak_mock.py module (also in tests) containing the Keycloak mocked class and simply declare the keycloak_mock fixture in the pytest_plugin file. Comment Actions
makes more sense than the current proposed diff, thanks Comment Actions Rework according to review This:
Comment Actions Build is green Patch application report for D5194 (id=18584)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit 16d3e0ae12117e5b4a1e02baedc6781c15b33c57 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/8/ for more details.
Comment Actions Update docstring on attributes missing explanation. Fix sphinx typo :py:data: for module attribute [1] [1] https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#python-roles Comment Actions Build is green Patch application report for D5194 (id=18585)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit e07dab6095ff8c6473201c1994914e69e7af55a4 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/9/ for more details. Comment Actions See inline comment.
Comment Actions Adapt according to review/discussion Allow re-definition of oidc_profile, user_info, raw_realm_public_key but let there be a When needed, the mock can be adapted so the decode_token method does the right and Comment Actions Build is green Patch application report for D5194 (id=18601)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit bbd8b85e21ae94275ca678396ca31a4cbd098159 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/10/ for more details. Comment Actions Build is green Patch application report for D5194 (id=18602)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit 13c984d7089c6300d89e16259097f72d5ea738d2 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/11/ for more details. Comment Actions Just a couple of small changes to add and we should be good here.
Comment Actions Adapt according to suggestions:
I did not modify the setters yet. Comment Actions Build is green Patch application report for D5194 (id=18610)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit 31a3a4fc9e25ee823aeb41bd76cdc4957d286ec3 Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/12/ for more details. Comment Actions A small little change and we are good.
Comment Actions Adapt according to last and way better implementation suggestion about the check Comment Actions Build is green Patch application report for D5194 (id=18611)Rebasing onto d2f211feb9... Current branch diff-target is up to date. Changes applied before testcommit 63b28edb1f40ddcfe16859156ee5c61ad9bc834b Author: Antoine R. Dumont (@ardumont) <antoine.romain.dumont@gmail.com> Date: Wed Mar 3 18:47:31 2021 +0100 Expose a pytest plugin for swh.auth.keycloak This will be required for modules depending on it (swh.web, swh.web.client, swh.deposit) Related to T3079 See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/13/ for more details. |