Skip to content

Fix: Inconsistent use of class and instance methods in test setup#923

Open
shreyas5522 wants to merge 2 commits intortCamp:mainfrom
shreyas5522:fix/test-setup-classmethod
Open

Fix: Inconsistent use of class and instance methods in test setup#923
shreyas5522 wants to merge 2 commits intortCamp:mainfrom
shreyas5522:fix/test-setup-classmethod

Conversation

@shreyas5522
Copy link
Copy Markdown

This PR fixes an inconsistency in the test setup where an instance method was being called from a class method (setUpClass).

Previously, setup_project_manager_role and assign_roles_to_user were defined as instance methods (using self) but were invoked from a class context using cls inside setUpClass. This mismatch could lead to runtime errors such as missing required positional arguments and results in inconsistent method design.

Changes made:

  • Converted setup_project_manager_role to a class method
  • Converted assign_roles_to_user to a class method
  • Updated internal calls to use cls instead of self

Additionally:

  • Handled potential None values in request parameters (params and data) to prevent runtime errors when merging dictionaries

This improves code correctness, consistency, and robustness without changing existing functionality.

Copilot AI review requested due to automatic review settings March 24, 2026 18:55
Copy link
Copy Markdown
Contributor

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 updates the shared TestNextPms test base class to make its setup helpers consistent with setUpClass usage (class context) and makes request helper methods more defensive when merging request parameters.

Changes:

  • Converted setup_project_manager_role and assign_roles_to_user from instance methods to @classmethod and updated call sites accordingly.
  • Made get() / post() merge logic tolerate None inputs when adding the session id (sid).
  • Minor docstring/formatting touch-ups in the test base class.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shreyas5522 shreyas5522 changed the title Fix inconsistent use of class and instance methods in test setup Fix: Inconsistent use of class and instance methods in test setup Mar 24, 2026
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.

2 participants