Skip to content

Fixed test cases + error return status code#360

Merged
minghansun1 merged 7 commits into
masterfrom
fix/marketplace-tests
Sep 7, 2025
Merged

Fixed test cases + error return status code#360
minghansun1 merged 7 commits into
masterfrom
fix/marketplace-tests

Conversation

@minghansun1
Copy link
Copy Markdown
Contributor

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.82%. Comparing base (0c83c35) to head (f070107).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #360      +/-   ##
==========================================
+ Coverage   84.54%   88.82%   +4.28%     
==========================================
  Files          73       73              
  Lines        3177     3177              
==========================================
+ Hits         2686     2822     +136     
+ Misses        491      355     -136     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes test cases by updating expiration dates from 2025 to 3000 for proper test isolation, removes obsolete test data, and corrects error response status codes in the market API.

  • Changed all test data expiration dates from 2025 to 3000 to ensure future-proof testing
  • Removed user_2_items.json test file that was no longer needed
  • Updated error responses to return proper 400 status codes instead of 406 for validation errors

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/tests/market/user_2_items.json Removed obsolete test data file
backend/tests/market/user_1_sublets.json Updated expiration dates to year 3000
backend/tests/market/user_1_items.json Updated expiration dates to year 3000
backend/tests/market/test_market.py Major test refactoring with new base class and updated test cases
backend/tests/market/self_user_sublets.json Updated expiration dates to year 3000
backend/tests/market/self_user_items.json Updated expiration dates to year 3000
backend/tests/market/mock_sublets.json Updated expiration dates to year 3000
backend/tests/market/mock_items.json Updated expiration dates to year 3000
backend/market/views.py Fixed error response status codes from 406 to 400

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread backend/tests/market/test_market.py
Comment thread backend/tests/market/test_market.py Outdated

def test_delete_offer_nonexistent(self):
response = self.client.delete("/market/items/6/offers/")
def test_delete_nonexistant_favorite(self):
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

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

"nonexistant" should be spelled "nonexistent".

Suggested change
def test_delete_nonexistant_favorite(self):
def test_delete_nonexistent_favorite(self):

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@dr-Jess dr-Jess left a comment

Choose a reason for hiding this comment

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

1-2 small changes off being done. Good stuff and thanks for handling this!

Comment thread backend/tests/market/mock_sublets.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove before merge

Comment thread backend/tests/market/mock_items.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove before merge

class TestMarket(TestCase):

class BaseMarketTest(TestCase):
def setUp(self):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We ought to maximize the amount of setup that is done here as opposed to copying code between each case. Please go through each case and find as much shared/stuff you can put here as possible :)

Copy link
Copy Markdown
Contributor

@dr-Jess dr-Jess left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Contributor

@dr-Jess dr-Jess left a comment

Choose a reason for hiding this comment

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

lgtm

@minghansun1 minghansun1 merged commit 16e16ec into master Sep 7, 2025
10 checks passed
@minghansun1 minghansun1 deleted the fix/marketplace-tests branch September 7, 2025 17:56
darrentweng pushed a commit that referenced this pull request Nov 21, 2025
* Fixed test cases + error return status code

* fixed failing tests

* fixed test case

* increased codecov

* uncommented shit

* fix tests

* removed unused stuff, increased shared setup
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