22import openphoto
33import test_base
44
5+ @unittest .skipIf (test_base .get_test_server_api () == 1 ,
6+ "The tag API didn't work at v1 - see frontend issue #927" )
57class TestTags (test_base .TestBase ):
68 testcase_name = "tag API"
79
810 def test_create_delete (self , tag_id = "create_tag" ):
9- """ Create a tag then delete it """
11+ """
12+ Create a tag then delete it.
13+ This test is a little contrived, since the tag create/delete
14+ endpoints are only intended for internal use.
15+ """
1016 # Create a tag
1117 self .assertTrue (self .client .tag .create (tag_id ))
1218 # Check that the tag doesn't exist (It has no photos, so it's invisible)
@@ -21,13 +27,21 @@ def test_create_delete(self, tag_id="create_tag"):
2127 self .assertTrue (self .client .tag .delete (tag_id ))
2228 # Check that the tag is now gone
2329 self .assertNotIn (tag_id , [t .id for t in self .client .tags .list ()])
30+ # Also remove the tag from the photo
31+ self .photos [0 ].update (tagsRemove = tag_id )
2432
25- # Create then delete using the Tag object directly
33+ # Create the tag again
2634 self .photos [0 ].update (tagsAdd = tag_id )
35+ self .assertIn (tag_id , [t .id for t in self .client .tags .list ()])
36+
37+ # Delete using the tag object directly
2738 tag = [t for t in self .client .tags .list () if t .id == tag_id ][0 ]
2839 self .assertTrue (tag .delete ())
40+
2941 # Check that the tag is now gone
3042 self .assertNotIn (tag_id , [t .id for t in self .client .tags .list ()])
43+ # Also remove the tag from the photo
44+ self .photos [0 ].update (tagsRemove = tag_id )
3145
3246 # TODO: Un-skip and update this tests once there are tag fields that can be updated.
3347 # The owner field cannot be updated.
0 commit comments