-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
REST API tests for GET jobs + GET jobs/ID/annotations #4295
Conversation
@kirill-sizov , I will merge the PR to unblock others. Please review it and share your comments next week. |
@pytest.mark.parametrize('groups', [['business'], ['user'], ['worker'], []]) | ||
def test_non_admin_get_job_annotations(self, org_id, groups, users, jobs, tasks, | ||
projects, annotations, memberships): | ||
users = [u for u in users if u['groups'] == groups][:4] | ||
jobs, kwargs = filter_jobs(jobs, tasks, org_id) | ||
org_staff = get_org_staff(org_id, memberships) | ||
|
||
# keep only the reasonable amount of jobs | ||
for job in jobs[:8]: | ||
job_staff = get_job_staff(job, tasks, projects) | ||
jid = str(job['id']) | ||
|
||
for user in users: | ||
if user['id'] in job_staff | org_staff: | ||
self._test_get_job_annotations_200(user['username'], | ||
jid, annotations['job'][jid], **kwargs) | ||
else: | ||
self._test_get_job_annotations_403(user['username'], | ||
jid, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this test can do more than one test for a similar test case, for example for test case (worker, not job staff) the function _test_get_job_annotations_403
will be call more than once. I think from IAM testing point of view we have no reason in testing similar action for all users with same privilege/memberships/job_ownership. What do you think, @nmanovic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kirill-sizov , I agree. If you see an easy way to reduce redundancy, I'm OK with the approach.
# Copyright (C) 2021 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this file led me to think why do we use numbers in filenames? If these numbers are not needed then I suggest to follow pattern test_{resource_name}.py
or if we have some reasons to keep this numbers in filenames than it's better to describe (in README) a convention of assignment of this numbers.
Motivation and context
How has this been tested?
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.