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

feat: adds endpoints for fetchGuestToken #27

Merged
merged 14 commits into from
Apr 16, 2024
Merged

feat: adds endpoints for fetchGuestToken #27

merged 14 commits into from
Apr 16, 2024

Conversation

pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Apr 10, 2024

Closes #23

Testing instructions

  1. Load the Instructor Dashboard
  2. Ensure you can continue to use Superset uninterrupted for 5 min.
  3. Add the SupersetXBlock to a course
  4. Ensure you can continue to use Superset within the XBlock in the LMS and Studio for 5 min.

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

* generate_superset_context : adds a superset_guest_token_url to the context
* generate_superset_token : called when ^ hit instead of on render.
* adds a plugin url and view
* removes superset_token from the context
* adds/updates tests
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 10, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Apr 10, 2024

Thanks for the pull request, @pomegranited! 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.

@pomegranited
Copy link
Contributor Author

pomegranited commented Apr 10, 2024

Hi @Ian2012 @bmtcril This is a draft PR because I haven't been able to load this branch into tutor dev to test it properly, but I'll rebuild tonight and start dealing with all the TODOs tomorrow.

Also, there's something up with celery during the tests -- I had to add a bunch of django apps to the test_settings INSTALLED_APPS, and that causes these errors to fail the tests: kombu.exceptions.OperationalError: [Errno 111] Connection refused . 029d3bd is a temporary workaround. Do you have any idea how to fix this issue?

Copy link

github-actions bot commented Apr 10, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  platform_plugin_aspects
  __init__.py
  apps.py
  signals.py
  urls.py
  utils.py
  views.py
  xblock.py
  platform_plugin_aspects/extensions
  filters.py
Project Total  

This report was generated by python-coverage-comment-action

platform_plugin_aspects/views.py Outdated Show resolved Hide resolved
test_settings.py Outdated
Comment on lines 45 to 48
"auth_user": {
"module": "django.contrib.auth.models",
"model": "User",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding this model to the settings causes the issues with Celery. For testing, there is no need to configure this model, you can mock the user or permissions. However I think you can disable Celery with CELERY_ALWAYS_EAGER.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried that, no luck :( Will have another go today.

Copy link
Contributor

@Ian2012 Ian2012 left a comment

Choose a reason for hiding this comment

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

There are some fixes for the crsf token and the bug with the reverse method: #28

Disconnecting these signal handlers during tests prevents errors like:

    kombu.exceptions.OperationalError: [Errno 111] Connection refused
…r permissions

Replaces the function-based view with a DRF view that:

* enforces session authentication
* enforces course staff/instructor role

Also reverts unneeded changes from previous commits.
to raise an exception instead of returning a tuple.

Adds tests to improve test coverage
so that reverse("platform_plugin_aspects:superset_guest_token") works
whether we're in standalone tests or a plugin to the platform.
@pomegranited
Copy link
Contributor Author

Thank you for your fixes @Ian2012 , I'm getting there.. hope to have this ready for your review tomorrow.

* generate_superset_context expects a course_id
* superset_guest_token_url should be absolute to LMS
* CSRF cookie fix from #28
* XBlock uses handler instead of view
* view handles Superset server errors
Copy link
Contributor Author

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

Boo.. I'm sorry @Ian2012 and @bmtcril , I'm still having issues getting all the pieces talking to each other :(
And I'm out of time for a few days, so if someone else wants to pick this up, please feel free!

platform_plugin_aspects/static/js/embed_dashboard.js Outdated Show resolved Hide resolved
@Ian2012 Ian2012 marked this pull request as ready for review April 12, 2024 17:24
@pomegranited
Copy link
Contributor Author

Thank you for your fixes @Ian2012 . I'm still unable to get this running in my dev stack, but I fixed the tests.
If it's working for you, please feel free to merge :) Otherwise I'll keep working on it.

@Ian2012 Ian2012 merged commit 3927b31 into main Apr 16, 2024
7 checks passed
@Ian2012 Ian2012 deleted the jill/refresh-token branch April 16, 2024 16:06
@openedx-webhooks
Copy link

@pomegranited 🎉 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
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Bug: Token refresh on embedded dashboards
3 participants