Skip to content

Add sleep to be able to test labeling service dashboard #1782

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

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions libs/labelbox/tests/integration/test_labeling_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
from datetime import datetime, timedelta
from time import sleep
from labelbox.schema.labeling_service import LabelingServiceStatus
from labelbox.schema.ontology_kind import EditorTaskType
from labelbox.schema.media_type import MediaType
from labelbox.schema.search_filters import IntegerValue, RangeDateTimeOperatorWithSingleValue, RangeOperatorWithSingleValue, DateRange, RangeOperatorWithValue, DateRangeValue, DateValue, IdOperator, OperationType, OrganizationFilter, TaskCompletedCountFilter, WorkforceRequestedDateFilter, WorkforceRequestedDateRangeFilter, WorkspaceFilter, TaskRemainingCountFilter

ALLOW_TIME_TO_CREATE_DASHBOARD = 5 ## seconds


def test_request_labeling_service_dashboard(requested_labeling_service):
project, _ = requested_labeling_service

labeling_service_dashboard = project.get_labeling_service_dashboard()
assert labeling_service_dashboard.status == LabelingServiceStatus.Requested
assert labeling_service_dashboard.tasks_completed == 0
assert labeling_service_dashboard.tasks_remaining == 0
assert labeling_service_dashboard.tasks_completed_count == 0
assert labeling_service_dashboard.tasks_remaining_count == 0
assert labeling_service_dashboard.media_type == MediaType.Conversational
assert labeling_service_dashboard.editor_task_type == EditorTaskType.ModelChatEvaluation
assert labeling_service_dashboard.service_type == "Live chat evaluation"

sleep(ALLOW_TIME_TO_CREATE_DASHBOARD)
labeling_service_dashboard = project.client.get_labeling_service_dashboards(
).get_one()
assert labeling_service_dashboard
Expand All @@ -29,6 +33,7 @@ def test_request_labeling_service_dashboard_filters(requested_labeling_service):
operator=IdOperator.Is,
values=[organization.uid])

sleep(ALLOW_TIME_TO_CREATE_DASHBOARD)
labeling_service_dashboard = project.client.get_labeling_service_dashboards(
search_query=[org_filter]).get_one()
assert labeling_service_dashboard is not None
Expand Down
Loading