Skip to content

test: add tests for Canvas Integration plugin#790

Open
arslanashraf7 wants to merge 1 commit into
mainfrom
arslan/8200-add-canvas-integration-tests
Open

test: add tests for Canvas Integration plugin#790
arslanashraf7 wants to merge 1 commit into
mainfrom
arslan/8200-add-canvas-integration-tests

Conversation

@arslanashraf7
Copy link
Copy Markdown
Contributor

@arslanashraf7 arslanashraf7 commented May 8, 2026

What are the relevant tickets?

https://github.com/mitodl/hq/issues/8200
This pull request introduces a comprehensive suite of new and improved tests for the ol_openedx_canvas_integration package. The changes focus on adding robust unit tests for the API, client, context API, handlers, and receivers modules. There are also some minor corrections and refactoring in test data structures and file organization. The overall goal is to ensure better coverage, reliability, and maintainability of the integration's core features.

New and Improved Test Coverage:

  • Added extensive unit tests for the api module, covering grade mapping, Canvas assignment creation/updating, and error handling for missing inputs.
  • Added comprehensive tests for the client module, including Canvas session handling, pagination, enrollment lookups, caching, assignment CRUD operations, and payload formatting.
  • Added tests for the context_api module, verifying resource loading and context section injection for Canvas integration.
  • Added tests for event handler functions to ensure proper task queuing logic for published and deleted XBlock events.
  • Added tests for signal receivers to confirm background grade sync tasks are triggered as expected.

Test Data Structure and File Organization Improvements:

  • Updated test fixtures in test_cms_tasks.py to use the correct assignment dictionary structure (mapping to dicts with id keys instead of plain ints) for consistency with production code. [1] [2]
  • Renamed and relocated test files for better organization and clarity, e.g., moving test_cms_tasks.py and test_settings.py to the main tests directory and updating path logic accordingly. [1] [2]

These changes significantly improve the reliability of the integration by ensuring that core logic is well-tested and that test data structures match the expectations of the production code.

Description (What does it do?)

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots

How can this be tested?

  • Take a look at the plugin and make sure the new tests cover everything
  • Take a look at the tests/code
  • Make sure the ol-openedx-canvas-integration tests run run and CI is green

Additional Context

@arslanashraf7 arslanashraf7 force-pushed the arslan/8200-add-canvas-integration-tests branch from 5a52f91 to d50315e Compare May 14, 2026 10:52
@arslanashraf7 arslanashraf7 changed the title feat: add tests for Canvas Integration plugin test: add tests for Canvas Integration plugin May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant