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 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
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 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
Ejemplo n.º 5
0
    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