File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
src/superannotate/lib/app/interface Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ minversion = 3.7
33log_cli =true
44python_files = test_*.py
55; pytest_plugins = ['pytest_profiling']
6- ; addopts = -n auto --dist=loadscope
6+ addopts = -n auto --dist =loadscope
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
910from tests .integration .base import BaseTestCase
1011
@@ -46,11 +47,15 @@ def test_vector_annotations_with_tag(self):
4647 metadata = sa .get_item_metadata (self .PROJECT_NAME , item_name = self .EXAMPLE_IMAGE_1 )
4748 assert metadata ['is_pinned' ] is True
4849
50+
51+ class TestPinImage (BaseTestCase ):
52+ PROJECT_NAME = "TestPinImage"
53+ PROJECT_TYPE = "Vector"
54+ PROJECT_DESCRIPTION = "TestPinImage"
55+
4956 def test_pin_image_negative_name (self ):
50- sa .attach_items (self .PROJECT_NAME , [{"url" : "some url" , "name" : self .EXAMPLE_IMAGE_1 }])
51- item = sa .search_items (self .PROJECT_NAME )[0 ]
52- assert not item ['is_pinned' ]
53- sa .pin_image (self .PROJECT_NAME , self .EXAMPLE_IMAGE_1 + 'NEW NAME' )
57+ with self .assertRaisesRegexp (AppException , "Item not found." ):
58+ sa .pin_image (self .PROJECT_NAME , 'NEW NAME' )
5459
5560
5661class TestVectorAnnotationsWithTagFolderUpload (BaseTestCase ):
You can’t perform that action at this time.
0 commit comments