Skip to content

test: port test_good_ajax_request (Word Cloud) from openedx-platform - #318

Open
irfanuddinahmad wants to merge 2 commits into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/word-cloud-good-ajax-request
Open

irfanuddinahmad wants to merge 2 commits into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/word-cloud-good-ajax-request

Conversation

@irfanuddinahmad

@irfanuddinahmad irfanuddinahmad commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Update (2026-11-10): Rebased onto main after #244: the file is now src/xblock_word_cloud/tests/test_word_cloud.py. The test is unchanged, and 9/9 tests in the file pass on the rebased branch.

Summary

Ports test_good_ajax_request from openedx-platform xmodule/tests/test_word_cloud.py into src/xblock_word_cloud/tests/test_word_cloud.py, keeping the original name, pre-seeded state and assertions.

During review of openedx/openedx-platform#38745, @farhan noted that #273 only partly ported this test. test_handle_submit_state_request starts from empty state and drops the pre-seeded all_words / top_words, so the merge of a student's words into existing counts was no longer asserted. They asked for the remaining fix to go in a new PR, with the original test names and logic kept intact.

What is kept from the original

  • Name: test_good_ajax_request
  • Seed: all_words = {'cat': 10, 'dog': 5, 'mom': 1, 'dad': 2}, top_words = {'cat': 10, 'dog': 5, 'dad': 2}, submitted = False
  • Call: block.submit_state({'student_words': ['cat', 'cat', 'dog', 'sun']}), exactly as the platform test's extracted-block path did
  • Assertions: status, submitted, total_count == 22, merged student_words, the full top_words list with percents, and percents summing to 100

The only adaptation: the platform built the block from DictFieldData(raw_field_data). Here the same values are set on the ToyRuntime block, matching the style of the existing tests in this file.

Origin: openedx-platform xmodule/tests/test_word_cloud.py::test_good_ajax_request (see openedx/openedx-platform#38745). The platform copy is also kept, so this adds coverage in this repo's CI. It is independent of #273 and based on main.

Test plan

  • pytest src/xblock_word_cloud/tests/test_word_cloud.py: 9 passed (8 existing + this one)
  • Full pytest xblocks_contrib xblock_pdf on main before the change: 846 passed, 1 skipped
  • ruff (E, F, W) clean on the changed file

🤖 Generated with Claude Code

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Nov 5, 2026
@openedx-webhooks

openedx-webhooks commented Nov 5, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

This repository is currently maintained by @openedx/axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@irfanuddinahmad

Copy link
Copy Markdown
Contributor Author

@farhan this is the follow-up you asked for on openedx/openedx-platform#38745. It restores test_good_ajax_request with its original name, the pre-seeded all_words/top_words and all original assertions (total_count == 22, the merged student_words, the full top_words list, and percents summing to 100), so the merge path is covered here as well. It's based on main and independent of #273. CI is green.

| Generated using Claude Code

irfanuddinahmad and others added 2 commits November 10, 2026 12:49
… seed and assertions

Restores the pre-seeded all_words/top_words merge path that the
handler-level port in openedx#273 (test_handle_submit_state_request) does not
assert. Name, setup and assertions match
openedx-platform xmodule/tests/test_word_cloud.py (openedx/openedx-platform#38745).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/word-cloud-good-ajax-request branch from e3bd464 to 4056262 Compare November 10, 2026 07:54
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

2 participants