1212
1313import pytest
1414
15- from nc_py_api import FsNode , LockType , NextcloudException , NextcloudExceptionNotFound
15+ from nc_py_api import (
16+ FsNode ,
17+ LockType ,
18+ NextcloudException ,
19+ NextcloudExceptionNotFound ,
20+ SystemTag ,
21+ )
1622
1723
1824class MyBytesIO (BytesIO ):
@@ -1152,7 +1158,7 @@ async def test_create_update_delete_tag_async(anc_any):
11521158 await anc_any .files .update_tag (tag )
11531159
11541160
1155- def test_assign_unassign_tag (nc_any ):
1161+ def test_get_assign_unassign_tag (nc_any ):
11561162 with contextlib .suppress (NextcloudExceptionNotFound ):
11571163 nc_any .files .delete_tag (nc_any .files .tag_by_name ("test_nc_py_api" ))
11581164 with contextlib .suppress (NextcloudExceptionNotFound ):
@@ -1167,8 +1173,10 @@ def test_assign_unassign_tag(nc_any):
11671173 assert tag2 .user_assignable is False
11681174 new_file = nc_any .files .upload ("/test_dir_tmp/tag_test.txt" , content = b"" )
11691175 new_file = nc_any .files .by_id (new_file )
1176+ assert nc_any .files .get_tags (new_file ) == []
11701177 assert len (nc_any .files .list_by_criteria (tags = [tag1 ])) == 0
11711178 nc_any .files .assign_tag (new_file , tag1 )
1179+ assert isinstance (nc_any .files .get_tags (new_file )[0 ], SystemTag )
11721180 assert len (nc_any .files .list_by_criteria (tags = [tag1 ])) == 1
11731181 assert len (nc_any .files .list_by_criteria (["favorite" ], tags = [tag1 ])) == 0
11741182 assert len (nc_any .files .list_by_criteria (tags = [tag1 , tag2 .tag_id ])) == 0
@@ -1182,7 +1190,7 @@ def test_assign_unassign_tag(nc_any):
11821190
11831191
11841192@pytest .mark .asyncio (scope = "session" )
1185- async def test_assign_unassign_tag_async (anc_any ):
1193+ async def test_get_assign_unassign_tag_async (anc_any ):
11861194 with contextlib .suppress (NextcloudExceptionNotFound ):
11871195 await anc_any .files .delete_tag (await anc_any .files .tag_by_name ("test_nc_py_api" ))
11881196 with contextlib .suppress (NextcloudExceptionNotFound ):
@@ -1197,8 +1205,10 @@ async def test_assign_unassign_tag_async(anc_any):
11971205 assert tag2 .user_assignable is False
11981206 new_file = await anc_any .files .upload ("/test_dir_tmp/tag_test.txt" , content = b"" )
11991207 new_file = await anc_any .files .by_id (new_file )
1208+ assert await anc_any .files .get_tags (new_file ) == []
12001209 assert len (await anc_any .files .list_by_criteria (tags = [tag1 ])) == 0
12011210 await anc_any .files .assign_tag (new_file , tag1 )
1211+ assert isinstance ((await anc_any .files .get_tags (new_file ))[0 ], SystemTag )
12021212 assert len (await anc_any .files .list_by_criteria (tags = [tag1 ])) == 1
12031213 assert len (await anc_any .files .list_by_criteria (["favorite" ], tags = [tag1 ])) == 0
12041214 assert len (await anc_any .files .list_by_criteria (tags = [tag1 , tag2 .tag_id ])) == 0
0 commit comments