Page MenuHomeSoftware Heritage

swh.auth.pytest_plugin: Make decoded_token consistent with user_info
ClosedPublic

Authored by ardumont on Mar 11 2021, 3:55 PM.

Details

Summary

Tester will want to craft carefully the keycloak mock so it returns
consistent data.

Currently the decoded_token and user_info are hard-coded to consistent values. So using
the default keycloak mock is ok. As soon as other testers will want another user_info,
the decoded token will diverge and not return the correct user_info subpart of the
decoded token.

This commits fixes such behavior and allows the decoded token to stay consistent with
the user_info.

Related to T2858

Diff Detail

Repository
rDAUTH Common authentication libraries
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5230 (id=18751)

Rebasing onto 68e9d921b1...

Current branch diff-target is up to date.
Changes applied before test
commit a05ecce635d7a34657dc81b4f2f4a162b036f702
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 11 15:53:12 2021 +0100

    swh.auth.pytest_plugin: Make decoded_token consistent with user_info
    
    Related to T2858

See https://jenkins.softwareheritage.org/job/DAUTH/job/tests-on-diff/27/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me.

This revision is now accepted and ready to land.Mar 11 2021, 4:09 PM