def setUp(self):
        self.api = AnnotationTypesApi()  # noqa: E501

        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()

        # create dummy team, image_sets and product
        teams = self.team_api.list_teams(name="test_annotation_type")
        if teams.count == 0:
            team = Team(name="test_annotation_type")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation_type")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation_type", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation_type")
        if products.count == 0:
            product = Product(name="test_annotation_type", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]


        self.team = team
        self.image_set = image_set 
        self.product = product 
Ejemplo n.º 2
0
 def setUp(self):
     self.api = ImageSetsApi()  # noqa: E501
     self.team_api = TeamsApi()
     # create dummy team
     teams = self.team_api.list_teams(name="test_image_sets")
     if len(teams.results) == 0:
         team = Team(name="test_image_sets")
         team = self.team_api.create_team(body=team)
     else:
         team = teams.results[0]
     self.team = team
Ejemplo n.º 3
0
    def setUp(self):
        self.api = AnnotationsApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()
        self.anno_type_api = AnnotationTypesApi()
        self.image_api = ImagesApi()

        # create dummy team, image_sets, product, image and anno_type
        teams = self.team_api.list_teams(name="test_annotation")
        if teams.count == 0:
            team = Team(name="test_annotation")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation")
        if products.count == 0:
            product = Product(name="test_annotation", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]

        annotation_types = self.anno_type_api.list_annotation_types(name="test_annotation")
        if annotation_types.count == 0:
            annotation_type = AnnotationType(name="test_annotation", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=product.id)
            annotation_type = self.anno_type_api.create_annotation_type(body=annotation_type)
        else:
            annotation_type = annotation_types.results[0]

        images = self.image_api.list_images(name="Eosinophile.png")
        if images.count == 0:
            file_path = "exact_sync/v1/test/images/Eosinophile.png"
            image_type = 0
            
            images = self.image_api.create_image(file_path=file_path, image_type=image_type, image_set=image_set.id)
            image = images.results[0]
        else:
            image = images.results[0]

        self.team = team
        self.image_set = image_set 
        self.product = product 
        self.annotation_type = annotation_type
        self.image = image
Ejemplo n.º 4
0
 def __init__(self, client):
     self.image_sets_api = ImageSetsApi(client)
     self.annotations_api = AnnotationsApi(client)
     self.annotation_types_api = AnnotationTypesApi(client)
     self.images_api = ImagesApi(client)
     self.product_api = ProductsApi(client)
     self.team_api = TeamsApi(client)
     self.users_api = UsersApi(client)
Ejemplo n.º 5
0
    def setUp(self):
        self.api = ImagesApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()

        # create dummy team and image_sets
        teams = self.team_api.list_teams(name="test_images")
        if teams.count == 0:
            team = Team(name="test_images")
            team = self.team_api.create_team(body=team)
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_images")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_images", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        self.team = team
        self.image_set = image_set
Ejemplo n.º 6
0
class TestImageSetsApi(unittest.TestCase):
    """ImageSetsApi unit test stubs"""
    def setUp(self):
        self.api = ImageSetsApi()  # noqa: E501
        self.team_api = TeamsApi()
        # create dummy team
        teams = self.team_api.list_teams(name="test_image_sets")
        if len(teams.results) == 0:
            team = Team(name="test_image_sets")
            team = self.team_api.create_team(body=team)
        else:
            team = teams.results[0]
        self.team = team

    def tearDown(self):

        self.team_api.destroy_team(id=self.team.id)
        pass

    def test_create_image_set(self):
        """Test case for create_image_set

        """
        image_set = ImageSet(name="create_image_set", team=self.team.id)
        created_imageset = self.api.create_image_set(body=image_set)

        self.api.destroy_image_set(id=created_imageset.id)
        pass

    def test_destroy_image_set(self):
        """Test case for destroy_image_set

        """
        image_set = ImageSet(name="destroy_image_set", team=self.team.id)
        created_imageset = self.api.create_image_set(body=image_set)

        self.api.destroy_image_set(id=created_imageset.id)

    def test_list_image_sets(self):
        """Test case for list_image_sets

        """
        image_sets = self.api.list_image_sets(omit="images")
        pass

    def test_partial_update_image_set(self):
        """Test case for partial_update_image_set

        """
        image_set = ImageSet(name="p_image_set", team=self.team.id)
        created_imageset = self.api.create_image_set(body=image_set)

        description = "BlaBla description"
        updated_imageset = self.api.partial_update_image_set(
            id=created_imageset.id, description=description)

        assert description == updated_imageset.description
        self.api.destroy_image_set(id=created_imageset.id)
        pass

    def test_retrieve_image_set(self):
        """Test case for retrieve_image_set

        """
        image_sets = self.api.list_image_sets(omit="images")
        image_set = image_sets.results[0]
        image_set = self.api.retrieve_image_set(id=image_set.id)
        pass

    def test_update_image_set(self):
        """Test case for update_image_set

        """
        image_set = ImageSet(name="u_image_set", team=self.team.id)
        created_imageset = self.api.create_image_set(body=image_set)

        created_imageset.description = "BlaBla Update"
        updated_imageset = self.api.update_image_set(id=created_imageset.id,
                                                     body=created_imageset)

        assert created_imageset.description == updated_imageset.description
        self.api.destroy_image_set(id=created_imageset.id)
        pass
Ejemplo n.º 7
0
class TestImagesApi(unittest.TestCase):
    """ImagesApi unit test stubs"""
    def setUp(self):
        self.api = ImagesApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()

        # create dummy team and image_sets
        teams = self.team_api.list_teams(name="test_images")
        if teams.count == 0:
            team = Team(name="test_images")
            team = self.team_api.create_team(body=team)
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_images")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_images", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        self.team = team
        self.image_set = image_set

    def tearDown(self):

        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)
        pass

    def test_create_image(self):
        """Test case for create_image

        """
        file_path = "exact_sync/v1/test/images/Eosinophile.png"
        image_type = 0
        image_set = self.image_set.id
        created_images = self.api.create_image(file_path=file_path,
                                               image_type=image_type,
                                               image_set=image_set)

        for image in created_images.results:
            self.api.destroy_image(id=image.id)
        pass

    def test_destroy_image(self):
        """Test case for destroy_image tested with test_create_image

        """

        pass

    def test_list_images(self):
        """Test case for list_images

        """
        images = self.api.list_images(omit="annotations")
        pass

    def test_partial_update_image(self):
        """Test case for partial_update_image

        """
        file_path = "exact_sync/v1/test/images/Eosinophile.png"
        image_type = 0
        image_set = self.image_set.id
        created_images = self.api.create_image(file_path=file_path,
                                               image_type=image_type,
                                               image_set=image_set)

        for image in created_images.results:
            objective_power = 40
            updated_image = self.api.partial_update_image(
                id=image.id, objective_power=objective_power)

            assert updated_image.objective_power == objective_power
            self.api.destroy_image(id=image.id)

    def test_retrieve_image(self):
        """Test case for retrieve_image

        """
        images = self.api.list_images(omit="annotations")
        image = images.results[0]
        image = self.api.retrieve_image(id=image.id)
        pass

    def test_update_image(self):
        """Test case for update_image

        """
        assert False
Ejemplo n.º 8
0
class TestAnnotationsApi(unittest.TestCase):
    """AnnotationsApi unit test stubs"""

    def setUp(self):
        self.api = AnnotationsApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()
        self.anno_type_api = AnnotationTypesApi()
        self.image_api = ImagesApi()

        # create dummy team, image_sets, product, image and anno_type
        teams = self.team_api.list_teams(name="test_annotation")
        if teams.count == 0:
            team = Team(name="test_annotation")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation")
        if products.count == 0:
            product = Product(name="test_annotation", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]

        annotation_types = self.anno_type_api.list_annotation_types(name="test_annotation")
        if annotation_types.count == 0:
            annotation_type = AnnotationType(name="test_annotation", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=product.id)
            annotation_type = self.anno_type_api.create_annotation_type(body=annotation_type)
        else:
            annotation_type = annotation_types.results[0]

        images = self.image_api.list_images(name="Eosinophile.png")
        if images.count == 0:
            file_path = "exact_sync/v1/test/images/Eosinophile.png"
            image_type = 0
            
            images = self.image_api.create_image(file_path=file_path, image_type=image_type, image_set=image_set.id)
            image = images.results[0]
        else:
            image = images.results[0]

        self.team = team
        self.image_set = image_set 
        self.product = product 
        self.annotation_type = annotation_type
        self.image = image

    def tearDown(self):

        self.image_api.destroy_image(id=self.image.id)
        self.anno_type_api.destroy_annotation_type(id=self.annotation_type.id)
        self.product_api.destroy_product(id=self.product.id)
        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)

        pass

    def test_create_annotation(self):
        
        """Test case for create_annotation

        """
        vector = {"x1":10, "x2":20, "y1":10, "y2":20}
        unique_identifier = str(uuid.uuid4())
        time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")
        annotation = Annotation(annotation_type=self.annotation_type.id, time=time, vector=vector, image=self.image.id, unique_identifier=unique_identifier)
        created_annotation = self.api.create_annotation(body=annotation)
        
        assert created_annotation.unique_identifier == unique_identifier
        assert created_annotation.time == time
        self.api.destroy_annotation(id=created_annotation.id)


    def test_create_annotation_list(self):
        """Test case for create_annotation

        """
        vector = {"x1":10, "x2":20, "y1":10, "y2":20}
        annotations = [Annotation(annotation_type=self.annotation_type.id, vector=vector, image=self.image.id) 
                        for i in range(10)]
        created_annotations = self.api.create_annotation(body=annotations)

    def test_destroy_annotation(self):
        """Test case for destroy_annotation

        """
        assert False

    def test_list_annotations(self):
        """Test case for list_annotations

        """
        annotations = self.api.list_annotations(omit="annotation_types")
        pass

    def test_partial_update_annotation(self):
        
        """Test case for partial_update_annotation

        """
        vector = {"x1":10, "x2":20, "y1":10, "y2":20}
        unique_identifier = str(uuid.uuid4())
        last_edit_time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")

        annotation = Annotation(annotation_type=self.annotation_type.id, vector=vector, image=self.image.id, unique_identifier=unique_identifier)
        created_annotation = self.api.create_annotation(body=annotation)
        
        new_vector = {"x1":100, "x2":200, "y1":100, "y2":200}
        updated_annotation = self.api.partial_update_annotation(id=created_annotation.id, last_edit_time=last_edit_time, vector=new_vector)
        
        assert new_vector == updated_annotation.vector
        assert last_edit_time == updated_annotation.last_edit_time
        self.api.destroy_annotation(id=created_annotation.id)

    def test_retrieve_annotation(self):
        
        """Test case for retrieve_annotation

        """
        annotations = self.api.list_annotations(omit="annotation_types")
        anno = annotations.results[0]
        annotation = self.api.retrieve_annotation(id=anno.id)
        pass

    def test_update_annotation(self):
        
        """Test case for update_annotation

        """
        vector = {"x1":10, "x2":20, "y1":10, "y2":20}
        unique_identifier = str(uuid.uuid4())
        annotation = Annotation(annotation_type=self.annotation_type.id, vector=vector, image=self.image.id, unique_identifier=unique_identifier)
        created_annotation = self.api.create_annotation(body=annotation)
        
        created_annotation.deleted = True
        updated_annotation = self.api.update_annotation(id=created_annotation.id, body=created_annotation)
        
        assert created_annotation.deleted == updated_annotation.deleted
        self.api.destroy_annotation(id=created_annotation.id)
Ejemplo n.º 9
0
class TestAnnotationMediaFilesApi(unittest.TestCase):
    """AnnotationMediaFilesApi unit test stubs"""

    def setUp(self):
        self.api = AnnotationMediaFilesApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()
        self.anno_type_api = AnnotationTypesApi()
        self.image_api = ImagesApi()
        self.annotations_api = AnnotationsApi()

        # create dummy team, image_sets, product, image, anno_type and annotation
        teams = self.team_api.list_teams(name="test_annotation")
        if teams.count == 0:
            team = Team(name="test_annotation")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation")
        if products.count == 0:
            product = Product(name="test_annotation", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]

        annotation_types = self.anno_type_api.list_annotation_types(name="test_annotation")
        if annotation_types.count == 0:
            annotation_type = AnnotationType(name="test_annotation", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=product.id)
            annotation_type = self.anno_type_api.create_annotation_type(body=annotation_type)
        else:
            annotation_type = annotation_types.results[0]

        images = self.image_api.list_images(name="Eosinophile.png")
        if images.count == 0:
            file_path = "exact_sync/v1/test/images/Eosinophile.png"
            image_type = 0
            
            images = self.image_api.create_image(file_path=file_path, image_type=image_type, image_set=image_set.id)
            image = images.results[0]
        else:
            image = images.results[0]

        annotations = self.annotations_api.list_annotations(image=image.id)
        if annotations.count == 0:
            vector = {"x1":10, "x2":20, "y1":10, "y2":20}
            annotation = Annotation(annotation_type=annotation_type.id, vector=vector, image=image.id)
            annotation = self.annotations_api.create_annotation(body=annotation)
        else:
            annotation = annotations.results[0]

        self.team = team
        self.image_set = image_set 
        self.product = product 
        self.annotation_type = annotation_type
        self.image = image
        self.annotation = annotation


    def tearDown(self):

        self.annotations_api.destroy_annotation(id=self.annotation.id)
        self.image_api.destroy_image(id=self.image.id)
        self.anno_type_api.destroy_annotation_type(id=self.annotation_type.id)
        self.product_api.destroy_product(id=self.product.id)
        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)

        pass

    def test_create_annotation_media_file(self):
        """Test case for create_annotation_media_file

        """
        file = "exact_sync/v1/test/images/sound.wav"
        name = "c_annotation_media_file"
        media_file_type = 4
        created_media_files = self.api.create_annotation_media_file(name=name, file=file, media_file_type=media_file_type, annotation=self.annotation.id)

        for media_file in created_media_files.results:

            new_name = "123.wav"
            updated = self.api.partial_update_annotation_media_file(id=media_file.id, name=new_name)
            
            assert new_name == updated.name
            self.api.destroy_annotation_media_file(id=media_file.id)

    def test_destroy_annotation_media_file(self):
        """Test case for destroy_annotation_media_file

        """
        assert False

    def test_list_annotation_media_files(self):
        """Test case for list_annotation_media_files

        """
        annotation_media_files = self.api.list_annotation_media_files()
        pass

    def test_partial_update_annotation_media_file(self):
        """Test case for partial_update_annotation_media_file

        """
        assert False

    def test_retrieve_annotation_media_file(self):
        """Test case for retrieve_annotation_media_file

        """
        annotation_media_files = self.api.list_annotation_media_files()
        media = annotation_media_files.results[0]
        annotation_media_file = self.api.retrieve_annotation_media_file(id=media.id)
        pass

    def test_update_annotation_media_file(self):
        """Test case for update_annotation_media_file

        """
        assert False
Ejemplo n.º 10
0
class TestSetTagsApi(unittest.TestCase):
    """SetTagsApi unit test stubs"""
    def setUp(self):
        self.api = SetTagsApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()

        # create dummy team and image_sets
        teams = self.team_api.list_teams(name="test_tags")
        if teams.count == 0:
            team = Team(name="test_tags")
            team = self.team_api.create_team(body=team)
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_set_tags")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_set_tags", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        self.team = team
        self.image_set = image_set

    def tearDown(self):

        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)
        pass

    def test_create_set_tag(self):
        """Test case for create_set_tag

        """
        tag = SetTag(name="create_set_tag", imagesets=[self.image_set.id])
        created_tag = self.api.create_set_tag(body=tag)

        self.api.destroy_set_tag(id=created_tag.id)
        pass

    def test_destroy_set_tag(self):
        """Test case for destroy_set_tag

        """
        tag = SetTag(name="destroy_set_tag", imagesets=[self.image_set.id])
        created_tag = self.api.create_set_tag(body=tag)

        self.api.destroy_set_tag(id=created_tag.id)
        pass

    def test_list_set_tags(self):
        """Test case for list_set_tags

        """
        tags = self.api.list_set_tags()
        pass

    def test_partial_update_set_tag(self):
        """Test case for partial_update_set_tag

        """
        tag = SetTag(name="p_update_set_tag", imagesets=[self.image_set.id])
        created_tag = self.api.create_set_tag(body=tag)

        new_name = "p_update_New"
        updated_tag = self.api.partial_update_set_tag(id=created_tag.id,
                                                      name=new_name)

        assert new_name == updated_tag.name
        self.api.destroy_set_tag(id=updated_tag.id)
        pass

    def test_retrieve_set_tag(self):
        """Test case for retrieve_set_tag

        """
        tags = self.api.list_set_tags()
        tag = tags.results[0]
        tag = self.api.retrieve_set_tag(id=tag.id)
        pass

    def test_update_set_tag(self):
        """Test case for update_set_tag

        """

        tag = SetTag(name="update_set_tag", imagesets=[self.image_set.id])
        created_tag = self.api.create_set_tag(body=tag)

        created_tag.name = "UpdateTag"
        updated_tag = self.api.update_set_tag(id=created_tag.id,
                                              body=created_tag)

        assert created_tag.name == updated_tag.name
        self.api.destroy_set_tag(id=updated_tag.id)
        pass
Ejemplo n.º 11
0
class TestProductsApi(unittest.TestCase):
    """ProductsApi unit test stubs"""
    def setUp(self):
        self.api = ProductsApi()  # noqa: E501
        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()

        # create dummy team and image_sets
        teams = self.team_api.list_teams(name="test_product")
        if teams.count == 0:
            team = Team(name="test_product")
            team = self.team_api.create_team(body=team)
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_product")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_product", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        self.team = team
        self.image_set = image_set

    def tearDown(self):

        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)
        pass

    def test_create_product(self):
        """Test case for create_product

        """
        product = Product(name="NewProduct",
                          imagesets=[self.image_set.id],
                          team=self.team.id)
        created_product = self.api.create_product(body=product)

        self.api.destroy_product(id=created_product.id)
        pass

    def test_destroy_product(self):
        """Test case for destroy_product

        """
        product = Product(name="DestroyProduct",
                          imagesets=[self.image_set.id],
                          team=self.team.id)
        created_product = self.api.create_product(body=product)

        self.api.destroy_product(id=created_product.id)
        assert False

    def test_list_products(self):
        """Test case for list_products

        """
        products = self.api.list_products()
        pass

    def test_partial_update_product(self):
        """Test case for partial_update_product

        """
        product = Product(name="Par_Product",
                          imagesets=[self.image_set.id],
                          team=self.team.id)
        created_product = self.api.create_product(body=product)

        description = "p_updateProduct"
        update_product = self.api.partial_update_product(
            id=created_product.id, description=description)

        assert description == update_product.description
        self.api.destroy_product(id=update_product.id)
        pass

    def test_retrieve_product(self):
        """Test case for retrieve_product

        """
        products = self.api.list_products()
        product = products.results[0]
        product = self.api.retrieve_product(id=product.id)

        pass

    def test_update_product(self):
        """Test case for update_product

        """
        product = Product(name="UpdateProduct",
                          imagesets=[self.image_set.id],
                          team=self.team.id)
        created_product = self.api.create_product(body=product)

        created_product.description = "u_updateProduct"
        update_product = self.api.update_product(id=created_product.id,
                                                 body=created_product)

        assert created_product.description == update_product.description
        self.api.destroy_product(id=update_product.id)
        pass
class TestAnnotationTypesApi(unittest.TestCase):
    """AnnotationTypesApi unit test stubs"""

    def setUp(self):
        self.api = AnnotationTypesApi()  # noqa: E501

        self.team_api = TeamsApi()
        self.image_sets_api = ImageSetsApi()
        self.product_api = ProductsApi()

        # create dummy team, image_sets and product
        teams = self.team_api.list_teams(name="test_annotation_type")
        if teams.count == 0:
            team = Team(name="test_annotation_type")
            team = self.team_api.create_team(body=team) 
        else:
            team = teams.results[0]

        image_sets = self.image_sets_api.list_image_sets(name="test_annotation_type")
        if image_sets.count == 0:
            image_set = ImageSet(name="test_annotation_type", team=team.id)
            image_set = self.image_sets_api.create_image_set(body=image_set)
        else:
            image_set = image_sets.results[0]

        products = self.product_api.list_products(name="test_annotation_type")
        if products.count == 0:
            product = Product(name="test_annotation_type", imagesets=[image_set.id], team=team.id)
            product = self.product_api.create_product(body=product)
        else:
            product = products.results[0]


        self.team = team
        self.image_set = image_set 
        self.product = product 


    def tearDown(self):

        self.product_api.destroy_product(id=self.product.id)
        self.image_sets_api.destroy_image_set(id=self.image_set.id)
        self.team_api.destroy_team(id=self.team.id)

    def test_create_annotation_type(self):
        """Test case for create_annotation_type

        """
        annotation_type = AnnotationType(name="create_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        self.api.destroy_annotation_type(id=created_annotation_type.id)
        pass

    def test_destroy_annotation_type(self):
        """Test case for destroy_annotation_type

        """
        annotation_type = AnnotationType(name="destroy_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        self.api.destroy_annotation_type(id=created_annotation_type.id)
        annotation_types = self.api.list_annotation_types(id=created_annotation_type.id)
        assert 0 == annotation_types.count
        pass

    def test_list_annotation_types(self):
        """Test case for list_annotation_types

        """
        annotation_type_list = self.api.list_annotation_types()
        pass

    def test_partial_update_annotation_type(self):
        """Test case for partial_update_annotation_type

        """
        annotation_type = AnnotationType(name="p_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        vector_type = int(AnnotationType.VECTOR_TYPE.FIXED_SIZE_BOUNDING_BOX)
        updated_anno_type = self.api.partial_update_annotation_type(id=created_annotation_type.id, vector_type=vector_type)


        assert vector_type == updated_anno_type.vector_type
        self.api.destroy_annotation_type(id=updated_anno_type.id)
        pass

    def test_retrieve_annotation_type(self):
        """Test case for retrieve_annotation_type

        """
        annotation_type_list = self.api.list_annotation_types()
        annotation_type = annotation_type_list.results[0]
        annotation_type = self.api.retrieve_annotation_type(id=annotation_type.id)
        pass

    def test_update_annotation_type(self):
        """Test case for update_annotation_type

        """
        annotation_type = AnnotationType(name="u_annotation_type", vector_type=int(AnnotationType.VECTOR_TYPE.BOUNDING_BOX), product=self.product.id)
        created_annotation_type = self.api.create_annotation_type(body=annotation_type)

        created_annotation_type.vector_type = int(AnnotationType.VECTOR_TYPE.FIXED_SIZE_BOUNDING_BOX)
        updated_anno_type = self.api.update_annotation_type(id=created_annotation_type.id, body=created_annotation_type)


        assert created_annotation_type.vector_type == updated_anno_type.vector_type
        self.api.destroy_annotation_type(id=updated_anno_type.id)
        pass