Skip to content

test: add tests for GradersController#7946

Merged
david-yz-liu merged 7 commits into
MarkUsProject:masterfrom
YheChen:graders-controller-tests
May 16, 2026
Merged

test: add tests for GradersController#7946
david-yz-liu merged 7 commits into
MarkUsProject:masterfrom
YheChen:graders-controller-tests

Conversation

@YheChen
Copy link
Copy Markdown
Contributor

@YheChen YheChen commented May 11, 2026

Proposed Changes

  • Added unauthorized-access test under student context following the format of existing tests in graders_controller_spec.rb
  • Added instructor context test that creates 2 groupings with multiple TAs, sends GET: grader_groupings_mapping and asserts the response is 200 OK with text/csv media type and the expected Content-Disposition attachment filename. Also parses the csv body and makes sure each grouping is mapped correctly to the grader usernames.
  • Updated Changelog.md to reflect above change
  • Added my name to doc/markus-contributors.txt
Screenshots of your changes (if applicable) image

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚦 Test update (change that only adds or modifies tests) X

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

  • Is it okay for me to delete sections of the PR description that are not applicable/not relevant to my PR to save space?

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 11, 2026

Coverage Report for CI Build 25967987835

Coverage increased (+0.01%) to 91.776%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 19 of 19 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 48979
Covered Lines: 45696
Line Coverage: 93.3%
Relevant Branches: 1870
Covered Branches: 971
Branch Coverage: 51.93%
Branches in Coverage %: Yes
Coverage Strength: 129.74 hits per line

💛 - Coveralls

@YheChen YheChen changed the title WIP: test: add tests for GradersController test: add tests for GradersController May 12, 2026
@YheChen YheChen requested a review from david-yz-liu May 12, 2026 03:29
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

Nice work, @YheChen! I left a few comments, and in addition to those I noticed that our pre-commit bot made some changes to your PR. This indicates that you may not have pre-commit hooks set up correctly locally on your machine; please review this part of the setup instructions.


context 'doing a GET on :grader_groupings_mapping' do
it 'returns a CSV mapping each grouping to its assigned graders' do
ta1 = create(:ta, user: create(:end_user, user_name: 'g9browni'))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rather than hard-code specific names here, you can write ta1 = create(:ta) and then below use ta1.user.user_name. This will help make the test expected values more explicitly connected to the underlying data.

The same is true for specifying group names.

Comment thread Changelog.md Outdated
### 🚨 Breaking changes

### ✨ New features and improvements

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In general please do not make formatting changes to files; formatting is configured through our pre-commit hooks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pre-commit should be properly setup on my laptop now

Comment thread Changelog.md Outdated

### ✨ New features and improvements

- Added tests for `GradersController` to fully cover `grader_groupers_mapping` (#7946)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add this to "Internal Changes". We reserve "New features and improvements" for user-facing changes.

@david-yz-liu
Copy link
Copy Markdown
Collaborator

Oh and in response to your question, please do not delete sections of the PR template. As part of my review I'll provide feedback on whether you've filled out the template correctly, and it's easier for me to do this review when all of the sections are present.

@YheChen YheChen force-pushed the graders-controller-tests branch from 28246a4 to a82bd77 Compare May 15, 2026 16:54
@david-yz-liu
Copy link
Copy Markdown
Collaborator

@YheChen please also do a pull from master (there were some flaky tests that I should have fixed in #7946)

@YheChen YheChen force-pushed the graders-controller-tests branch from 75092d0 to 897adf2 Compare May 15, 2026 18:48
@YheChen YheChen requested a review from david-yz-liu May 15, 2026 19:14
Comment thread Changelog.md Outdated
- Sync due date when creating or updating LTI gradebook line items, and re-sync automatically when an assessment is edited (#7872)

### 🐛 Bug fixes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are still whitespace changes throughout this file that should be reverted. (You might find it easier to reset the file to how it is on master and then just add back in the new entry.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh I just added Changelog.md to .prettierignore, didn't realize that was an option

@YheChen YheChen requested a review from david-yz-liu May 16, 2026 17:07
Copy link
Copy Markdown
Contributor Author

@YheChen YheChen left a comment

Choose a reason for hiding this comment

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

i did not mean to click the start review button

@YheChen YheChen force-pushed the graders-controller-tests branch from b8bc7eb to 62ea07e Compare May 16, 2026 17:11
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

Nice work, @YheChen!

@david-yz-liu david-yz-liu merged commit b4f99cf into MarkUsProject:master May 16, 2026
7 checks passed
@YheChen YheChen deleted the graders-controller-tests branch May 17, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants