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

change to new edx user service #224

Merged
merged 5 commits into from
Mar 18, 2022
Merged

Conversation

sroertgen
Copy link
Contributor

As discussed in #217 edX changed its internal user service.

This PR implements these changes.

@openedx-webhooks
Copy link

openedx-webhooks commented Jan 25, 2022

Thanks for the pull request, @sroertgen! I've created OSPR-6413 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@giovannicimolin
Copy link
Contributor

@sroertgen Awesome work here.
Before we can accept code, we need a signed contributor agreement. Can you follow the instructions above?

Let me know if you have any questions. I'll find the right person to help you if you bump into any issues.

@natabene
Copy link
Contributor

@sroertgen
Thank you for the contribution! Once you have signed our Contributor Agreement and it has been processed, you will receive a confirmation via email from our Legal team. We then will be able to review this and all your future code contributions.

@sroertgen
Copy link
Contributor Author

Thank you both!
I filled out the document and send it to your legal team.

Have a nice weekend!

@natabene
Copy link
Contributor

@sroertgen Thank you very much! Once they process it and you are cleared, I will post here.

@giovannicimolin
Copy link
Contributor

giovannicimolin commented Jan 31, 2022

@sroertgen Some tests are failing because of the User service mock isn't returning proper values, can you fix that? See https://github.com/openedx/xblock-lti-consumer/runs/4982515609?check_suite_focus=true.


Edit: I noticed that commitlint in failing here as well.

You'll need to:


Thanks for your patience here, the strict CI/rulechecks can be a hassle if it's your first time around. Let me know if you need any help. 😁

@sroertgen
Copy link
Contributor Author

@giovannicimolin oh yes, there are tests :D

I will have a look into this! And thanks for the hints!

@natabene
Copy link
Contributor

natabene commented Feb 4, 2022

@sroertgen Thank you for signing, you are all set now. Next commit or rebase should clear the cla check.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed community manager review labels Feb 4, 2022
@sroertgen
Copy link
Contributor Author

Hey @giovannicimolin,

I fixed the tests. Had a bit of struggle squashing my commits, but I hope it is now as you expect (was a good opportunity for me starting with this best practice ;) )

Please let me know, if I have to do anything else.

@sroertgen
Copy link
Contributor Author

just saw the failing test. I just ran make test, but there seem to be more tests as it seems 😃
Will have a look into it

@giovannicimolin
Copy link
Contributor

@sroertgen There's quality checks too, make sure you run those as well. :)

@sroertgen
Copy link
Contributor Author

@giovannicimolin If you don't mind, you can try running the workflows again.

@giovannicimolin
Copy link
Contributor

@sroertgen Tests running 😁

@codecov
Copy link

codecov bot commented Feb 9, 2022

Codecov Report

Merging #224 (8c74c7d) into master (6491871) will decrease coverage by 0.04%.
The diff coverage is 95.74%.

@@            Coverage Diff             @@
##           master     #224      +/-   ##
==========================================
- Coverage   97.14%   97.10%   -0.05%     
==========================================
  Files          66       66              
  Lines        4694     4698       +4     
==========================================
+ Hits         4560     4562       +2     
- Misses        134      136       +2     
Flag Coverage Δ
unittests 97.10% <95.74%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lti_consumer/lti_xblock.py 95.09% <81.81%> (-0.51%) ⬇️
lti_consumer/tests/unit/test_lti_xblock.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6491871...8c74c7d. Read the comment docs.

@openedx-webhooks openedx-webhooks added awaiting prioritization and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Feb 11, 2022
@natabene
Copy link
Contributor

@sroertgen @giovannicimolin Is this good for our review?

Copy link
Contributor

@giovannicimolin giovannicimolin left a comment

Choose a reason for hiding this comment

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

@sroertgen Did a full review and testing of the changes and left a few suggestions in the PR.

lti_consumer/lti_xblock.py Outdated Show resolved Hide resolved
Comment on lines 688 to 693
try:
role = self.runtime.service(self, 'user').get_current_user().opt_attrs['edx-platform.user_role']
# opt_attrs might not be present or the "edx-platform.user_role" key if opt_attrs is present
except (KeyError, AttributeError):
role = "student"
return ROLE_MAP.get(role, 'Student')
Copy link
Contributor

Choose a reason for hiding this comment

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

You can always consider opt_attrs as a valid attribute (this is defined here), simplifying this to:

Suggested change
try:
role = self.runtime.service(self, 'user').get_current_user().opt_attrs['edx-platform.user_role']
# opt_attrs might not be present or the "edx-platform.user_role" key if opt_attrs is present
except (KeyError, AttributeError):
role = "student"
return ROLE_MAP.get(role, 'Student')
role = self.runtime.service(self, 'user').get_current_user().opt_attrs.get('edx-platform.user_role', 'student')
return ROLE_MAP.get(role, 'Student')

lti_consumer/lti_xblock.py Outdated Show resolved Hide resolved
@sroertgen
Copy link
Contributor Author

Thanks! Will have a look into this during this week!

@sroertgen
Copy link
Contributor Author

Hey @giovannicimolin,

sorry it took a bit longer, but I had to hand in two proposals in the last weeks and just did not have time to work on your suggestions.

Thanks for the hints! I implemented the changes and am looking forward for your feedback.

Best,
Steffen

@sroertgen
Copy link
Contributor Author

Sorry, my make quality test suggested to delete the line that now threw the error. I just put it back in.

@natabene
Copy link
Contributor

@giovannicimolin Could you finalize reviewing and merge when ready? Owning team is fine with you review and mege.

@giovannicimolin
Copy link
Contributor

@natabene Sure! I'm planning to review this today - sorry for the delay in the reply.

@natabene
Copy link
Contributor

@giovannicimolin Thanks!

Copy link
Contributor

@giovannicimolin giovannicimolin left a comment

Choose a reason for hiding this comment

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

👍

  • I tested this:
  1. Tested LTI 1.1 launches from both the LMS and Studio and checked the data.
  2. Individually tested each method modified and checked it's results on the LMS and Studio environments using a debugger.
  • I read through the code
  • I checked for accessibility issues NA
  • Includes documentation NA

@sroertgen Great work! Thanks for the contribution.

I'll fix the commit-lint error using GitHub's squash and merge feature.

@giovannicimolin giovannicimolin merged commit fd717e0 into openedx:master Mar 18, 2022
@openedx-webhooks
Copy link

@sroertgen 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants