Repository navigation
test: port test_good_ajax_request (Word Cloud) from openedx-platform - #318
irfanuddinahmad wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
@farhan this is the follow-up you asked for on openedx/openedx-platform#38745. It restores | Generated using Claude Code |
… 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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
e3bd464 to
4056262
Compare
Summary
Ports
test_good_ajax_requestfrom openedx-platformxmodule/tests/test_word_cloud.pyintosrc/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_requeststarts from empty state and drops the pre-seededall_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
test_good_ajax_requestall_words = {'cat': 10, 'dog': 5, 'mom': 1, 'dad': 2},top_words = {'cat': 10, 'dog': 5, 'dad': 2},submitted = Falseblock.submit_state({'student_words': ['cat', 'cat', 'dog', 'sun']}), exactly as the platform test's extracted-block path didstatus,submitted,total_count == 22, mergedstudent_words, the fulltop_wordslist with percents, and percents summing to 100The only adaptation: the platform built the block from
DictFieldData(raw_field_data). Here the same values are set on theToyRuntimeblock, 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 onmain.Test plan
pytest src/xblock_word_cloud/tests/test_word_cloud.py: 9 passed (8 existing + this one)pytest xblocks_contrib xblock_pdfonmainbefore the change: 846 passed, 1 skippedruff(E, F, W) clean on the changed file🤖 Generated with Claude Code