File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
src/superannotate/lib/app/interface Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -703,11 +703,14 @@ def pin_image(
703703 :type pin: bool
704704 """
705705 project , folder = self .controller .get_project_folder_by_path (project )
706- item = self .controller .items .get_by_name (project , folder , image_name ).data
706+ response = self .controller .items .get_by_name (project , folder , image_name )
707+ if response .errors :
708+ raise AppException (response .errors )
709+ item = response .data
707710 item .is_pinned = int (pin )
708711 self .controller .items .update (
709712 project = project ,
710- item = item ,
713+ item = item
711714 )
712715
713716 def delete_items (self , project : str , items : Optional [List [str ]] = None ):
Original file line number Diff line number Diff line change 55
66import pytest
77
8+ from src .superannotate import AppException
89from src .superannotate import SAClient
10+ from tests .integration .base import BaseTestCase
911
1012sa = SAClient ()
11- from tests .integration .base import BaseTestCase
1213
1314
1415class TestVectorAnnotationsWithTag (BaseTestCase ):
@@ -44,7 +45,17 @@ def test_vector_annotations_with_tag(self):
4445 self .assertEqual (annotations ['instances' ][0 ]['attributes' ][0 ]['groupName' ], 'g1' )
4546 sa .pin_image (self .PROJECT_NAME , self .EXAMPLE_IMAGE_1 , pin = True )
4647 metadata = sa .get_item_metadata (self .PROJECT_NAME , item_name = self .EXAMPLE_IMAGE_1 )
47- assert metadata ['is_pinned' ] == True
48+ assert metadata ['is_pinned' ] is True
49+
50+
51+ class TestPinImage (BaseTestCase ):
52+ PROJECT_NAME = "TestPinImage"
53+ PROJECT_TYPE = "Vector"
54+ PROJECT_DESCRIPTION = "TestPinImage"
55+
56+ def test_pin_image_negative_name (self ):
57+ with self .assertRaisesRegexp (AppException , "Item not found." ):
58+ sa .pin_image (self .PROJECT_NAME , 'NEW NAME' )
4859
4960
5061class TestVectorAnnotationsWithTagFolderUpload (BaseTestCase ):
You can’t perform that action at this time.
0 commit comments