Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Project-Teams API tests #5631

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

d-rita
Copy link
Contributor

@d-rita d-rita commented Mar 13, 2023

This PR handles project-teams related API endpoint tests.

How to test:

  • create a test database following the instructions here. The database name is preceded by test_
  • pull and checkout test branch using git fetch origin && git checkout chore/add-project-teams-tests
  • run tests using python3 -m unittest discover tests/backend

- Add projects-teams API endpoint tests
- Fix project teams exceptions and retrieval of user id
@d-rita d-rita force-pushed the chore/add-project-teams-tests branch from d950790 to db00081 Compare March 24, 2023 08:13
@sonarcloud
Copy link

sonarcloud bot commented Mar 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@d-rita d-rita requested a review from Aadesh-Baral April 3, 2023 09:39
response_body["Error"], "User is not an admin or a manager for the team"
)
self.assertEqual(response_body["SubCode"], "UserPermissionError")

Copy link
Contributor

Choose a reason for hiding this comment

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

A test to determine if 403 is raised when the user does not have permission to update the project appears to be missing as well. Only a team's user permission is tested in the test above

Also test to determine whether a 400 is raised when an invalid team role is passed appears to be missing.

self.assertEqual(response.status_code, 403)
self.assertEqual(response_body["Error"], "User is not a manager of the project")
self.assertEqual(response_body["SubCode"], "UserPermissionError")

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here a test to determine whether a 400 is raised when an invalid team role is passed appears to be missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants