-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: access_token is stored in global conf not local .aio #150
feat: access_token is stored in global conf not local .aio #150
Conversation
This change checks where an IMS context is defined, and stores the tokens in the same location (i.e. local or global). Furthermore, on logout, _only_ the tokens are removed, rather than the entire IMS context being rewritten, as was the case previously. The context data is the merged view of global and local configs for a context, so rewriting it risks accidentally copying data between the local IMS context definition and the global one.
- fix test cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the test runner passes (coverage should be 100%)
@jsedding Any chance for increasing the code coverage in order to unblock adobe/aio-cli-plugin-aem-rde#97? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #150 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 488 490 +2
Branches 68 69 +1
=========================================
+ Hits 488 490 +2 ☔ View full report in Codecov by Sentry. |
I have added a testcase where no local flag is passed so the default to false assignment is triggered, the coverage is now back to 100%. |
This will be released as 7.1.0 |
Thanks @RemoLiechti for completing the coverage, and thanks @shazron and @amulyakashyap09 for accepting this PR! |
Sorry, it's actually released now as 7.0.2 https://github.com/adobe/aio-lib-ims/releases/tag/7.0.2 |
Reinstalling the cli might not pick up the changes according to my testing, please uninstall first: |
Shaz, thank you very much! I will test this today and come back to you. |
reviewer's note: this fix is essentially, if the context is local (thus overriding any global), persist to local.
Description
This change checks where an IMS context is defined, and stores the tokens in the same location (i.e. local or global).
Furthermore, on logout, only the tokens are removed, rather than the entire IMS context being rewritten, as was the case previously. The context data is the merged view of global and local configs for a context, so rewriting it risks accidentally copying data between the local IMS context definition and the global one.
Related Issue
fixes #67
Motivation and Context
We want to leverage IMS contexts in the
aio-cli-plugin-aem-rde
to make usage more convenient for users.How Has This Been Tested?
This was manually tested by verifying the date was written to and deleted from the correct configuration files. The small change in
StateActionContext
is only a guess/best effort. I don't know in which scenario this implementation is used, so couldn't test.Also, existing test cases were adjusted.
Screenshots (if appropriate):
Types of changes
Checklist: