Skip to content

Commit

Permalink
Predictions crud test (HumanSignal#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
triklozoid committed Jul 8, 2021
1 parent 2f00e2f commit b89e37a
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
101 changes: 101 additions & 0 deletions label_studio/tests/predictions.tavern.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
test_name: crud
strict: false
marks:
- usefixtures:
- django_live_url
stages:
- id: signup
type: ref
- id: create_project
type: ref
- id: create_task
type: ref
- id: create_prediction
name: create_prediction
request:
json:
result:
- value:
choices:
- Negative
id: qpQHs3Yy4K
from_name: sentiment
to_name: text
type: choices
model_version: 'test'
task: '{task_pk}'
method: POST
url: '{django_live_url}/api/predictions'
response:
save:
json:
prediction_pk: id
status_code: 201
- id: get_prediction_by_id
name: get_prediction_by_id
request:
method: GET
url: '{django_live_url}/api/predictions/{prediction_pk}/'
response:
json:
id: !int '{prediction_pk}'
result:
- value:
choices:
- Negative
id: qpQHs3Yy4K
from_name: sentiment
to_name: text
type: choices
status_code: 200

- id: get_prediction_for_task
name: get_prediction_for_task
request:
method: GET
url: '{django_live_url}/api/predictions/?task={task_pk}'
response:
json:
- id: !int '{prediction_pk}'
result:
- value:
choices:
- Negative
id: qpQHs3Yy4K
from_name: sentiment
to_name: text
type: choices
status_code: 200
- id: update_prediction
name: update_prediction
request:
json:
model_version: 'test1'
method: PATCH
url: '{django_live_url}/api/predictions/{prediction_pk}/'
response:
status_code: 200
- id: get_prediction_by_id_after_update
name: get_prediction_by_id_after_update
request:
method: GET
url: '{django_live_url}/api/predictions/{prediction_pk}/'
response:
json:
model_version: 'test1'
status_code: 200
- id: delete_prediction
name: delete_prediction
request:
method: DELETE
url: '{django_live_url}/api/predictions/{prediction_pk}/'
response:
status_code: 204
- id: prediction_not_found_after_delete
name: prediction_not_found_after_delete
request:
method: GET
url: '{django_live_url}/api/predictions/{prediction_pk}/'
response:
status_code: 404
14 changes: 14 additions & 0 deletions label_studio/tests/shared_stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,17 @@ stages:
json:
user_pk: id
active_organization_pk: active_organization
- id: create_task
name: create_task
request:
json:
data:
text: 'Test text'
project: '{project_pk}'
method: POST
url: '{django_live_url}/api/tasks'
response:
save:
json:
task_pk: id
status_code: 201

0 comments on commit b89e37a

Please sign in to comment.