def test_task_creation_arguments(self):
    dataset = foz.load_zoo_dataset('quickstart', max_samples=4).select_fields('ground_truth').clone()
    user = fo.annotation_config.backends.get('cvat', {})
    user = user.get('username', None)
    users = ([user] if (user is not None) else None)
    anno_key = 'anno_key'
    bug_tracker = 'test_tracker'
    results = dataset.annotate(anno_key, backend='cvat', label_field='ground_truth', task_size=2, segment_size=1, task_assignee=users, job_assignees=users, job_reviewers=users, issue_tracker=bug_tracker)
    task_ids = results.task_ids
    api = results.connect_to_api()
    self.assertEqual(len(task_ids), 2)
    for task_id in task_ids:
        task_json = api.get(api.task_url(task_id)).json()
        self.assertEqual(task_json['bug_tracker'], bug_tracker)
        self.assertEqual(task_json['segment_size'], 1)
        if (user is not None):
            self.assertEqual(task_json['assignee']['username'], user)
        for job in api.get(api.jobs_url(task_id)).json():
            job_json = api.get(job['url']).json()
            if (user is not None):
                self.assertEqual(job_json['assignee']['username'], user)
                if (api.server_version == 1):
                    self.assertEqual(job_json['reviewer']['username'], user)
    results.print_status()
    status = results.get_status()
    self.assertEqual(status['ground_truth'][task_ids[0]]['assignee']['username'], user)
    dataset.load_annotations(anno_key, cleanup=True)
    api.close()
def test_task_creation_arguments(self):
    dataset = foz.load_zoo_dataset('quickstart', max_samples=4).select_fields('ground_truth').clone()
    user = fo.annotation_config.backends.get('cvat', {})
    user = user.get('username', None)
    users = ([user] if (user is not None) else None)
    anno_key = 'anno_key'
    bug_tracker = 'test_tracker'
    results = dataset.annotate(anno_key, backend='cvat', label_field='ground_truth', task_size=2, segment_size=1, task_assignee=users, job_assignees=users, job_reviewers=users, issue_tracker=bug_tracker)
    task_ids = results.task_ids
    api = results.connect_to_api()
    self.assertEqual(len(task_ids), 2)
    for task_id in task_ids:
        task_json = api.get(api.task_url(task_id)).json()
        self.assertEqual(task_json['bug_tracker'], bug_tracker)
        self.assertEqual(task_json['segment_size'], 1)
        if (user is not None):
            self.assertEqual(task_json['assignee']['username'], user)
        for job in api.get(api.jobs_url(task_id)).json():
            job_json = api.get(job['url']).json()
            if (user is not None):
                self.assertEqual(job_json['assignee']['username'], user)
                if (api.server_version == 1):
                    self.assertEqual(job_json['reviewer']['username'], user)
    results.print_status()
    status = results.get_status()
    self.assertEqual(status['ground_truth'][task_ids[0]]['assignee']['username'], user)
    dataset.load_annotations(anno_key, cleanup=True)
    api.close()