REST API tests with skeletons (#4987)

main
Anastasia Yasakova 3 years ago committed by GitHub
parent 5f44603db2
commit ddcee5b3a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- SDK section in docs (<https://github.com/opencv/cvat/pull/4928>)
- An env variable to enable or disable host certificate checking in CLI (<https://github.com/opencv/cvat/pull/4928>)
- REST API tests with skeletons (<https://github.com/opencv/cvat/pull/4987>)
### Changed
- `api/docs`, `api/swagger`, `api/schema` endpoints now allow unauthorized access (<https://github.com/opencv/cvat/pull/4928>)
@ -25,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
non-ascii paths while adding files from "Connected file share" (issue #4428)
- Removed unnecessary volumes defined in docker-compose.serverless.yml
(<https://github.com/openvinotoolkit/cvat/pull/4659>)
- Project import with skeletons (<https://github.com/opencv/cvat/pull/4867>,
- Project import/export with skeletons (<https://github.com/opencv/cvat/pull/4867>,
<https://github.com/opencv/cvat/pull/5004>)
### Security

@ -241,7 +241,7 @@ class TestPatchJobAnnotations:
users = find_users(role=role, org=org)
jobs = jobs_by_org[org]
filtered_jobs = filter_jobs_with_shapes(jobs)
username, jid = find_job_staff_user(filtered_jobs, users, job_staff)
username, jid = find_job_staff_user(filtered_jobs, users, job_staff, [18])
data = request_data(jid)
self._check_respone(username, jid, expect_success, data, org=org)
@ -255,7 +255,7 @@ class TestPatchJobAnnotations:
users = find_users(privilege=privilege, exclude_org=org)
jobs = jobs_by_org[org]
filtered_jobs = filter_jobs_with_shapes(jobs)
username, jid = find_job_staff_user(filtered_jobs, users, False)
username, jid = find_job_staff_user(filtered_jobs, users, False, [18])
data = request_data(jid)
self._check_respone(username, jid, expect_success, data, org=org)

@ -349,16 +349,91 @@ class TestImportExportDatasetProject:
self._test_import_project(admin_user, project_id, 'CVAT 1.1', import_data)
def test_can_export_and_import_dataset_with_skeletons_coco_keypoints(self, admin_user):
project_id = 5
response = self._test_export_project(admin_user, project_id, 'COCO Keypoints 1.0')
tmp_file = io.BytesIO(response.data)
tmp_file.name = 'dataset.zip'
import_data = {
'dataset_file': tmp_file,
}
self._test_import_project(admin_user, project_id, 'COCO Keypoints 1.0', import_data)
def test_can_export_and_import_dataset_with_skeletons_cvat_for_images(self, admin_user):
project_id = 5
response = self._test_export_project(admin_user, project_id, 'CVAT for images 1.1')
tmp_file = io.BytesIO(response.data)
tmp_file.name = 'dataset.zip'
import_data = {
'dataset_file': tmp_file,
}
self._test_import_project(admin_user, project_id, 'CVAT 1.1', import_data)
def test_can_export_and_import_dataset_with_skeletons_cvat_for_video(self, admin_user):
project_id = 5
response = self._test_export_project(admin_user, project_id, 'CVAT for video 1.1')
tmp_file = io.BytesIO(response.data)
tmp_file.name = 'dataset.zip'
import_data = {
'dataset_file': tmp_file,
}
self._test_import_project(admin_user, project_id, 'CVAT 1.1', import_data)
def _test_can_get_project_backup(self, username, pid, **kwargs):
for _ in range(30):
response = get_method(username, f"projects/{pid}/backup", **kwargs)
response.raise_for_status()
if response.status_code == HTTPStatus.CREATED:
break
sleep(1)
response = get_method(username, f"projects/{pid}/backup", action="download", **kwargs)
assert response.status_code == HTTPStatus.OK
return response
def test_admin_can_get_project_backup_and_create_project_by_backup(self, admin_user):
project_id = 5
response = self._test_can_get_project_backup(admin_user, project_id)
tmp_file = io.BytesIO(response.content)
tmp_file.name = 'dataset.zip'
import_data = {
'project_file': tmp_file,
}
with make_api_client(admin_user) as api_client:
(_, response) = api_client.projects_api.create_backup(
backup_write_request=deepcopy(import_data),
_content_type="multipart/form-data")
assert response.status == HTTPStatus.ACCEPTED
@pytest.mark.usefixtures('changedb')
class TestPatchProjectLabel:
def test_admin_can_delete_label(self, projects):
project = deepcopy(list(projects)[0])
project = deepcopy(list(projects)[1])
labels = project['labels'][0]
labels.update({'deleted': True})
response = patch_method('admin1', f'/projects/{project["id"]}', {'labels': [labels]})
assert response.status_code == HTTPStatus.OK
assert len(response.json()['labels']) == len(project['labels']) - 1
def test_admin_can_delete_skeleton_label(self, projects):
project = deepcopy(list(projects)[0])
labels = project['labels'][0]
labels.update({'deleted': True})
response = patch_method('admin1', f'/projects/{project["id"]}', {'labels': [labels]})
assert response.status_code == HTTPStatus.OK
assert len(response.json()['labels']) == len(project['labels']) - 4
def test_admin_can_rename_label(self, projects):
project = deepcopy(list(projects)[0])
labels = project['labels'][0]

@ -157,6 +157,77 @@ class TestPostTasks:
users = find_users(org=org['id'], role=role)
self._test_users_to_create_task_in_project(project_id, users, is_staff, is_allow, is_project_staff, org=org['slug'])
def test_can_create_task_with_skeleton(self):
username = "admin1"
spec = {
"name": f'test admin1 to create a task with skeleton',
"labels": [
{
"name": "s1",
"color": "#5c5eba",
"attributes": [
{
"name": "color",
"mutable": False,
"input_type": "select",
"default_value": "white",
"values": [
"white",
"black"
]
}
],
"type": "skeleton",
"sublabels": [
{
"name": "1",
"color": "#d53957",
"attributes": [
{
"id": 23,
"name": "attr",
"mutable": False,
"input_type": "select",
"default_value": "val1",
"values": [
"val1",
"val2"
]
}
],
"type": "points"
},
{
"name": "2",
"color": "#4925ec",
"attributes": [],
"type": "points"
},
{
"name": "3",
"color": "#59a8fe",
"attributes": [],
"type": "points"
}
],
"svg": "<line x1=\"36.329429626464844\" y1=\"45.98662185668945\" x2=\"59.07190704345703\" y2=\"23.076923370361328\" " \
"stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line>" \
"<line x1=\"22.61705780029297\" y1=\"25.75250816345215\" x2=\"36.329429626464844\" y2=\"45.98662185668945\" " \
"stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line>" \
"<circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"22.61705780029297\" cy=\"25.75250816345215\" " \
"stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-name=\"1\">" \
"</circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"36.329429626464844\" cy=\"45.98662185668945\" " \
"stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-name=\"2\"></circle>" \
"<circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"59.07190704345703\" cy=\"23.076923370361328\" " \
"stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-name=\"3\"></circle>"
}
]
}
self._test_create_task_201(username, spec)
@pytest.mark.usefixtures('dontchangedb')
class TestGetData:
_USERNAME = 'user1'
@ -226,7 +297,7 @@ class TestPatchTaskAnnotations:
find_task_staff_user, find_users, tasks_by_org, request_data):
users = find_users(role=role, org=org)
tasks = tasks_by_org[org]
username, tid = find_task_staff_user(tasks, users, task_staff)
username, tid = find_task_staff_user(tasks, users, task_staff, [14])
data = request_data(tid)
with make_api_client(username) as api_client:

@ -105,7 +105,8 @@ class TestJobUsecases:
task_id = fxt_new_task.id
path = str(self.tmp_path / f"task_{task_id}-cvat.zip")
job = self.client.jobs.retrieve(task_id)
job_id = fxt_new_task.get_jobs()[0].id
job = self.client.jobs.retrieve(job_id)
job.export_dataset(
format_name="CVAT for images 1.1",
filename=path,

@ -364,6 +364,293 @@
"tags": [],
"tracks": [],
"version": 0
},
"18": {
"shapes": [
{
"attributes": [
{
"spec_id": 2,
"value": "white"
}
],
"elements": [
{
"attributes": [
{
"spec_id": 3,
"value": "val1"
}
],
"frame": 0,
"group": 0,
"id": 39,
"label_id": 25,
"occluded": false,
"outside": false,
"points": [
259.91862203681984,
67.8260869565238
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 40,
"label_id": 26,
"occluded": false,
"outside": false,
"points": [
283.65217391304554,
276.52173913043686
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 37,
"label_id": 23,
"occluded": false,
"outside": false,
"points": [
135.8260869565238,
118.10276296228554
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 38,
"label_id": 24,
"occluded": false,
"outside": false,
"points": [
172.10450871201368,
274.6245183225243
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
}
],
"frame": 0,
"group": 0,
"id": 36,
"label_id": 22,
"occluded": false,
"outside": false,
"points": [],
"rotation": 0.0,
"source": "manual",
"type": "skeleton",
"z_order": 0
}
],
"tags": [],
"tracks": [
{
"attributes": [
{
"spec_id": 2,
"value": "white"
}
],
"elements": [
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 2,
"label_id": 23,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 2,
"occluded": false,
"outside": false,
"points": [
381.9130434782637,
355.0592829431864
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 6,
"occluded": false,
"outside": false,
"points": [
137.0966796875,
156.11214469590232
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 3,
"label_id": 24,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 3,
"occluded": false,
"outside": false,
"points": [
461.9389738212561,
583.320176176868
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 7,
"occluded": false,
"outside": false,
"points": [
217.12261003049207,
384.3730379295848
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [
{
"spec_id": 3,
"value": "val1"
}
],
"frame": 0,
"group": 0,
"id": 4,
"label_id": 25,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 4,
"occluded": false,
"outside": false,
"points": [
655.6465767436227,
281.7391304347839
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 8,
"occluded": false,
"outside": false,
"points": [
410.83021295285835,
82.7919921875
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 5,
"label_id": 26,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 5,
"occluded": false,
"outside": false,
"points": [
708.000000000003,
586.0869565217404
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 9,
"occluded": false,
"outside": false,
"points": [
463.1836362092399,
387.13981827445605
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
}
],
"frame": 0,
"group": 0,
"id": 1,
"label_id": 22,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 1,
"occluded": false,
"outside": false,
"points": [],
"rotation": 0.0,
"type": "skeleton",
"z_order": 0
}
],
"source": "manual"
}
],
"version": 0
}
},
"task": {
@ -719,6 +1006,293 @@
"tags": [],
"tracks": [],
"version": 0
},
"14": {
"shapes": [
{
"attributes": [
{
"spec_id": 2,
"value": "white"
}
],
"elements": [
{
"attributes": [
{
"spec_id": 3,
"value": "val1"
}
],
"frame": 0,
"group": 0,
"id": 39,
"label_id": 25,
"occluded": false,
"outside": false,
"points": [
259.91862203681984,
67.8260869565238
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 40,
"label_id": 26,
"occluded": false,
"outside": false,
"points": [
283.65217391304554,
276.52173913043686
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 37,
"label_id": 23,
"occluded": false,
"outside": false,
"points": [
135.8260869565238,
118.10276296228554
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 38,
"label_id": 24,
"occluded": false,
"outside": false,
"points": [
172.10450871201368,
274.6245183225243
],
"rotation": 0.0,
"source": "manual",
"type": "points",
"z_order": 0
}
],
"frame": 0,
"group": 0,
"id": 36,
"label_id": 22,
"occluded": false,
"outside": false,
"points": [],
"rotation": 0.0,
"source": "manual",
"type": "skeleton",
"z_order": 0
}
],
"tags": [],
"tracks": [
{
"attributes": [
{
"spec_id": 2,
"value": "white"
}
],
"elements": [
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 2,
"label_id": 23,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 2,
"occluded": false,
"outside": false,
"points": [
381.9130434782637,
355.0592829431864
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 6,
"occluded": false,
"outside": false,
"points": [
137.0966796875,
156.11214469590232
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 3,
"label_id": 24,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 3,
"occluded": false,
"outside": false,
"points": [
461.9389738212561,
583.320176176868
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 7,
"occluded": false,
"outside": false,
"points": [
217.12261003049207,
384.3730379295848
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [
{
"spec_id": 3,
"value": "val1"
}
],
"frame": 0,
"group": 0,
"id": 4,
"label_id": 25,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 4,
"occluded": false,
"outside": false,
"points": [
655.6465767436227,
281.7391304347839
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 8,
"occluded": false,
"outside": false,
"points": [
410.83021295285835,
82.7919921875
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
},
{
"attributes": [],
"frame": 0,
"group": 0,
"id": 5,
"label_id": 26,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 5,
"occluded": false,
"outside": false,
"points": [
708.000000000003,
586.0869565217404
],
"rotation": 0.0,
"type": "points",
"z_order": 0
},
{
"attributes": [],
"frame": 3,
"id": 9,
"occluded": false,
"outside": false,
"points": [
463.1836362092399,
387.13981827445605
],
"rotation": 0.0,
"type": "points",
"z_order": 0
}
],
"source": "manual"
}
],
"frame": 0,
"group": 0,
"id": 1,
"label_id": 22,
"shapes": [
{
"attributes": [],
"frame": 0,
"id": 1,
"occluded": false,
"outside": false,
"points": [],
"rotation": 0.0,
"type": "skeleton",
"z_order": 0
}
],
"source": "manual"
}
],
"version": 0
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,8 +1,205 @@
{
"count": 11,
"count": 12,
"next": null,
"previous": null,
"results": [
{
"assignee": null,
"bug_tracker": "",
"data_chunk_size": 72,
"data_compressed_chunk_type": "imageset",
"dimension": "2d",
"id": 18,
"labels": [
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "white",
"id": 2,
"input_type": "select",
"mutable": false,
"name": "color",
"values": [
"white",
"black"
]
}
],
"color": "#0c81b5",
"has_parent": false,
"id": 22,
"name": "s2",
"sublabels": [
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"65.6380615234375\" y1=\"18.394649505615234\" x2=\"22.327028274536133\" y2=\"54.8494987487793\" stroke=\"black\" data-type=\"edge\" data-node-from=\"3\" stroke-width=\"0.5\" data-node-to=\"2\"></line><line x1=\"77.34375\" y1=\"55.18394470214844\" x2=\"65.6380615234375\" y2=\"18.394649505615234\" stroke=\"black\" data-type=\"edge\" data-node-from=\"4\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"4.434051036834717\" y1=\"27.257524490356445\" x2=\"77.34375\" y2=\"55.18394470214844\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"4\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"4.434051036834717\" cy=\"27.257524490356445\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"23\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"22.327028274536133\" cy=\"54.8494987487793\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"24\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"65.6380615234375\" cy=\"18.394649505615234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"25\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"77.34375\" cy=\"55.18394470214844\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"4\" data-node-id=\"4\" data-label-id=\"26\"></circle>",
"type": "skeleton"
},
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#5c5eba",
"has_parent": false,
"id": 18,
"name": "s1",
"sublabels": [
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"36.37385177612305\" y1=\"50.334449768066406\" x2=\"70.15311431884766\" y2=\"21.237457275390625\" stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"29.517663955688477\" y1=\"15.050167083740234\" x2=\"36.37385177612305\" y2=\"50.334449768066406\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"29.517663955688477\" cy=\"15.050167083740234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"19\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"36.37385177612305\" cy=\"50.334449768066406\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"20\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"70.15311431884766\" cy=\"21.237457275390625\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"21\"></circle>",
"type": "skeleton"
}
],
"mode": "annotation",
"project_id": 5,
"stage": "annotation",
"start_frame": 0,
"state": "in progress",
"status": "annotation",
"stop_frame": 7,
"task_id": 14,
"updated_date": "2022-09-23T11:57:02.302000Z",
"url": "http://localhost:8080/api/jobs/18"
},
{
"assignee": null,
"bug_tracker": "",

@ -1,8 +1,220 @@
{
"count": 4,
"count": 5,
"next": null,
"previous": null,
"results": [
{
"assignee": null,
"bug_tracker": "",
"created_date": "2022-09-22T14:21:53.791000Z",
"dimension": "2d",
"id": 5,
"labels": [
{
"attributes": [],
"color": "#5c5eba",
"has_parent": false,
"id": 18,
"name": "s1",
"sublabels": [
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"36.37385177612305\" y1=\"50.334449768066406\" x2=\"70.15311431884766\" y2=\"21.237457275390625\" stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"29.517663955688477\" y1=\"15.050167083740234\" x2=\"36.37385177612305\" y2=\"50.334449768066406\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"29.517663955688477\" cy=\"15.050167083740234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"19\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"36.37385177612305\" cy=\"50.334449768066406\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"20\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"70.15311431884766\" cy=\"21.237457275390625\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"21\"></circle>",
"type": "skeleton"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "white",
"id": 2,
"input_type": "select",
"mutable": false,
"name": "color",
"values": [
"white",
"black"
]
}
],
"color": "#0c81b5",
"has_parent": false,
"id": 22,
"name": "s2",
"sublabels": [
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"65.6380615234375\" y1=\"18.394649505615234\" x2=\"22.327028274536133\" y2=\"54.8494987487793\" stroke=\"black\" data-type=\"edge\" data-node-from=\"3\" stroke-width=\"0.5\" data-node-to=\"2\"></line><line x1=\"77.34375\" y1=\"55.18394470214844\" x2=\"65.6380615234375\" y2=\"18.394649505615234\" stroke=\"black\" data-type=\"edge\" data-node-from=\"4\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"4.434051036834717\" y1=\"27.257524490356445\" x2=\"77.34375\" y2=\"55.18394470214844\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"4\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"4.434051036834717\" cy=\"27.257524490356445\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"23\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"22.327028274536133\" cy=\"54.8494987487793\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"24\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"65.6380615234375\" cy=\"18.394649505615234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"25\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"77.34375\" cy=\"55.18394470214844\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"4\" data-node-id=\"4\" data-label-id=\"26\"></circle>",
"type": "skeleton"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"sublabels": [],
"type": "points"
}
],
"name": "project5",
"organization": 2,
"owner": {
"first_name": "Admin",
"id": 1,
"last_name": "First",
"url": "http://localhost:8080/api/users/1",
"username": "admin1"
},
"source_storage": {
"cloud_storage_id": null,
"id": 5,
"location": "local"
},
"status": "annotation",
"target_storage": {
"cloud_storage_id": null,
"id": 6,
"location": "local"
},
"task_subsets": [],
"tasks": [
14
],
"updated_date": "2022-09-23T11:57:02.088000Z",
"url": "http://localhost:8080/api/projects/5"
},
{
"assignee": null,
"bug_tracker": "",

@ -1,8 +1,243 @@
{
"count": 9,
"count": 10,
"next": null,
"previous": null,
"results": [
{
"assignee": null,
"bug_tracker": "",
"created_date": "2022-09-22T14:22:25.820000Z",
"data": 13,
"data_chunk_size": 72,
"data_compressed_chunk_type": "imageset",
"data_original_chunk_type": "imageset",
"dimension": "2d",
"id": 14,
"image_quality": 70,
"labels": [
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [
{
"default_value": "white",
"id": 2,
"input_type": "select",
"mutable": false,
"name": "color",
"values": [
"white",
"black"
]
}
],
"color": "#0c81b5",
"has_parent": false,
"id": 22,
"name": "s2",
"sublabels": [
{
"attributes": [],
"color": "#4a649f",
"has_parent": true,
"id": 26,
"name": "4",
"type": "points"
},
{
"attributes": [
{
"default_value": "val1",
"id": 3,
"input_type": "select",
"mutable": false,
"name": "attr",
"values": [
"val1",
"val2"
]
}
],
"color": "#59a8fe",
"has_parent": true,
"id": 25,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#4925ec",
"has_parent": true,
"id": 24,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d53957",
"has_parent": true,
"id": 23,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"65.6380615234375\" y1=\"18.394649505615234\" x2=\"22.327028274536133\" y2=\"54.8494987487793\" stroke=\"black\" data-type=\"edge\" data-node-from=\"3\" stroke-width=\"0.5\" data-node-to=\"2\"></line><line x1=\"77.34375\" y1=\"55.18394470214844\" x2=\"65.6380615234375\" y2=\"18.394649505615234\" stroke=\"black\" data-type=\"edge\" data-node-from=\"4\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"4.434051036834717\" y1=\"27.257524490356445\" x2=\"77.34375\" y2=\"55.18394470214844\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"4\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"4.434051036834717\" cy=\"27.257524490356445\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"23\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"22.327028274536133\" cy=\"54.8494987487793\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"24\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"65.6380615234375\" cy=\"18.394649505615234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"25\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"77.34375\" cy=\"55.18394470214844\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"4\" data-node-id=\"4\" data-label-id=\"26\"></circle>",
"type": "skeleton"
},
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"sublabels": [],
"type": "points"
},
{
"attributes": [],
"color": "#5c5eba",
"has_parent": false,
"id": 18,
"name": "s1",
"sublabels": [
{
"attributes": [],
"color": "#479ffe",
"has_parent": true,
"id": 21,
"name": "3",
"type": "points"
},
{
"attributes": [],
"color": "#350dea",
"has_parent": true,
"id": 20,
"name": "2",
"type": "points"
},
{
"attributes": [],
"color": "#d12345",
"has_parent": true,
"id": 19,
"name": "1",
"type": "points"
}
],
"svg": "<line x1=\"36.37385177612305\" y1=\"50.334449768066406\" x2=\"70.15311431884766\" y2=\"21.237457275390625\" stroke=\"black\" data-type=\"edge\" data-node-from=\"2\" stroke-width=\"0.5\" data-node-to=\"3\"></line><line x1=\"29.517663955688477\" y1=\"15.050167083740234\" x2=\"36.37385177612305\" y2=\"50.334449768066406\" stroke=\"black\" data-type=\"edge\" data-node-from=\"1\" stroke-width=\"0.5\" data-node-to=\"2\"></line><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"29.517663955688477\" cy=\"15.050167083740234\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"1\" data-node-id=\"1\" data-label-id=\"19\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"36.37385177612305\" cy=\"50.334449768066406\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"2\" data-node-id=\"2\" data-label-id=\"20\"></circle><circle r=\"1.5\" stroke=\"black\" fill=\"#b3b3b3\" cx=\"70.15311431884766\" cy=\"21.237457275390625\" stroke-width=\"0.1\" data-type=\"element node\" data-element-id=\"3\" data-node-id=\"3\" data-label-id=\"21\"></circle>",
"type": "skeleton"
}
],
"mode": "annotation",
"name": "task1 in project5",
"organization": 2,
"overlap": 0,
"owner": {
"first_name": "Admin",
"id": 1,
"last_name": "First",
"url": "http://localhost:8080/api/users/1",
"username": "admin1"
},
"project_id": 5,
"segment_size": 8,
"segments": [
{
"jobs": [
{
"assignee": null,
"id": 18,
"stage": "annotation",
"state": "in progress",
"status": "annotation",
"url": "http://localhost:8080/api/jobs/18"
}
],
"start_frame": 0,
"stop_frame": 7
}
],
"size": 8,
"source_storage": {
"cloud_storage_id": null,
"id": 7,
"location": "local"
},
"status": "annotation",
"subset": "",
"target_storage": {
"cloud_storage_id": null,
"id": 8,
"location": "local"
},
"updated_date": "2022-09-23T11:57:02.300000Z",
"url": "http://localhost:8080/api/tasks/14"
},
{
"assignee": null,
"bug_tracker": "",

@ -310,7 +310,7 @@
"is_active": true,
"is_staff": true,
"is_superuser": true,
"last_login": "2022-07-19T14:27:42.006000Z",
"last_login": "2022-09-22T14:21:28.429000Z",
"last_name": "First",
"url": "http://localhost:8080/api/users/1",
"username": "admin1"

@ -237,8 +237,10 @@ def is_org_member(memberships):
@pytest.fixture(scope='session')
def find_job_staff_user(is_job_staff):
def find(jobs, users, is_staff):
def find(jobs, users, is_staff, wo_jobs=None):
for job in jobs:
if wo_jobs is not None and job['id'] in wo_jobs:
continue
for user in users:
if is_staff == is_job_staff(user['id'], job['id']):
return user['username'], job['id']
@ -247,8 +249,10 @@ def find_job_staff_user(is_job_staff):
@pytest.fixture(scope='session')
def find_task_staff_user(is_task_staff):
def find(tasks, users, is_staff):
def find(tasks, users, is_staff, wo_tasks=None):
for task in tasks:
if wo_tasks is not None and task['id'] in wo_tasks:
continue
for user in users:
if is_staff == is_task_staff(user['id'], task['id']):
return user['username'], task['id']

Loading…
Cancel
Save