-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filter tests for data manager (#1279)
* Update LSF, DM, react-app * Add tests for data manager filters * Old build of react app * [fix] Show correct expected classes on import validation error * [fix] Make "is empty" for strings working * Fix tests and use KeyTextTransform from postgres * Remove TextField from import * [fix] is empty for all fields * Revert String case
- Loading branch information
Showing
7 changed files
with
444 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,267 @@ | ||
--- | ||
test_name: int-filter-greater | ||
strict: false | ||
marks: | ||
- usefixtures: | ||
- django_live_url | ||
stages: | ||
|
||
- id: signup | ||
type: ref | ||
|
||
- id: create_project | ||
type: ref | ||
|
||
- name: create_filter_tasks | ||
request: | ||
files: | ||
json_file: tests/data_manager/filters/int_tasks.json | ||
headers: | ||
content-type: multipart/form-data | ||
method: POST | ||
url: '{django_live_url}/api/projects/{project_pk}/import' | ||
response: | ||
json: | ||
annotation_count: 0 | ||
prediction_count: 1 | ||
task_count: 6 | ||
status_code: 201 | ||
|
||
- name: setup_views | ||
request: | ||
method: POST | ||
url: '{django_live_url}/api/dm/views/?project={project_pk}' | ||
json: { | ||
"data": { | ||
"columnsDisplayType": { | ||
"tasks:data.int_field": "Number" | ||
}, | ||
"filters": { | ||
"conjunction": "and", | ||
"items": [ | ||
{ | ||
"filter": "filter:tasks:data.int_field", | ||
"operator": "greater", | ||
"type": "Number", | ||
"value": 5 | ||
} | ||
] | ||
}, | ||
"ordering": [ | ||
"tasks:data.int_field" | ||
] | ||
}, | ||
"project": "{project_pk}" | ||
} | ||
response: | ||
save: | ||
json: | ||
view: "@" | ||
status_code: 201 | ||
|
||
- name: get_tasks | ||
request: | ||
method: GET | ||
url: '{django_live_url}/api/dm/views/{view.id}/tasks' | ||
response: | ||
json: { | ||
"total_annotations": 0, | ||
"total_predictions": 0, | ||
"total": 3, | ||
"tasks": [ | ||
{ | ||
"data": { | ||
"int_field": 20, | ||
"text": "x2" | ||
} | ||
}, | ||
{ | ||
"data": { | ||
"int_field": 30, | ||
"text": "x3" | ||
} | ||
}, | ||
{ | ||
"data": { | ||
"int_field": "50", | ||
"text": "x5" | ||
} | ||
} | ||
] | ||
} | ||
status_code: 200 | ||
|
||
|
||
|
||
--- | ||
test_name: int-filter-between-in | ||
strict: false | ||
marks: | ||
- usefixtures: | ||
- django_live_url | ||
stages: | ||
|
||
- id: signup | ||
type: ref | ||
|
||
- id: create_project | ||
type: ref | ||
|
||
- name: create_filter_tasks | ||
request: | ||
files: | ||
json_file: tests/data_manager/filters/int_tasks.json | ||
headers: | ||
content-type: multipart/form-data | ||
method: POST | ||
url: '{django_live_url}/api/projects/{project_pk}/import' | ||
response: | ||
json: | ||
annotation_count: 0 | ||
prediction_count: 1 | ||
task_count: 6 | ||
status_code: 201 | ||
|
||
- name: setup_views | ||
request: | ||
method: POST | ||
url: '{django_live_url}/api/dm/views/?project={project_pk}' | ||
json: { | ||
"data": { | ||
"columnsDisplayType": { | ||
"tasks:data.int_field": "Number" | ||
}, | ||
"filters": { | ||
"conjunction": "and", | ||
"items": [ | ||
{ | ||
"filter": "filter:tasks:data.int_field", | ||
"operator": "in", | ||
"type": "Number", | ||
"value": { | ||
"min": 10, | ||
"max": 40 | ||
} | ||
} | ||
] | ||
}, | ||
"ordering": [ | ||
"tasks:data.int_field" | ||
] | ||
}, | ||
"project": "{project_pk}" | ||
} | ||
response: | ||
save: | ||
json: | ||
view: "@" | ||
status_code: 201 | ||
|
||
- name: get_tasks | ||
request: | ||
method: GET | ||
url: '{django_live_url}/api/dm/views/{view.id}/tasks' | ||
response: | ||
json: { | ||
"total_annotations": 0, | ||
"total_predictions": 0, | ||
"total": 2, | ||
"tasks": [ | ||
{ | ||
"data": { | ||
"int_field": 20, | ||
"text": "x2" | ||
} | ||
}, | ||
{ | ||
"data": { | ||
"int_field": 30, | ||
"text": "x3" | ||
} | ||
} | ||
] | ||
} | ||
status_code: 200 | ||
|
||
|
||
--- | ||
test_name: int-is-empty | ||
strict: false | ||
marks: | ||
- usefixtures: | ||
- django_live_url | ||
stages: | ||
|
||
- id: signup | ||
type: ref | ||
|
||
- id: create_project | ||
type: ref | ||
|
||
- name: create_filter_tasks | ||
request: | ||
files: | ||
json_file: tests/data_manager/filters/int_tasks.json | ||
headers: | ||
content-type: multipart/form-data | ||
method: POST | ||
url: '{django_live_url}/api/projects/{project_pk}/import' | ||
response: | ||
json: | ||
annotation_count: 0 | ||
prediction_count: 1 | ||
task_count: 6 | ||
status_code: 201 | ||
|
||
- name: setup_views | ||
request: | ||
method: POST | ||
url: '{django_live_url}/api/dm/views/?project={project_pk}' | ||
json: { | ||
"data": { | ||
"columnsDisplayType": { | ||
"tasks:data.int_field": "Number" | ||
}, | ||
"filters": { | ||
"conjunction": "and", | ||
"items": [ | ||
{ | ||
"filter": "filter:tasks:data.int_field", | ||
"operator": "empty", | ||
"type": "Number", | ||
"value": "true" | ||
} | ||
] | ||
}, | ||
"ordering": [ | ||
"tasks:data.int_field" | ||
] | ||
}, | ||
"project": "{project_pk}" | ||
} | ||
response: | ||
save: | ||
json: | ||
view: "@" | ||
status_code: 201 | ||
|
||
- name: get_tasks | ||
request: | ||
method: GET | ||
url: '{django_live_url}/api/dm/views/{view.id}/tasks' | ||
response: | ||
json: { | ||
"total_annotations": 0, | ||
"total_predictions": 0, | ||
"total": 1, | ||
"tasks": [ | ||
{ | ||
"data": { | ||
"text": "x6" | ||
} | ||
} | ||
] | ||
} | ||
status_code: 200 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[ | ||
{ | ||
"data": { | ||
"text": "Test example phrase 1", | ||
"int_field": 1 | ||
}, | ||
"predictions": [ | ||
{ | ||
"result": [ | ||
{ | ||
"from_name": "text_class", | ||
"to_name": "text", | ||
"type": "choices", | ||
"value": { | ||
"choices": [ | ||
"class_A" | ||
] | ||
} | ||
} | ||
], | ||
"model_version": "model_version_A" | ||
} | ||
] | ||
}, | ||
{ | ||
"int_field": 20, | ||
"text": "x2" | ||
}, | ||
{ | ||
"int_field": 30, | ||
"text": "x3" | ||
}, | ||
{ | ||
"int_field": 4, | ||
"text": "x4" | ||
}, | ||
{ | ||
"int_field": "50", | ||
"text": "x5" | ||
}, | ||
|
||
{ | ||
"text": "x6" | ||
} | ||
] |
Oops, something went wrong.