2525 BlobBlock , generate_account_sas , ResourceTypes , AccountSasPermissions , generate_container_sas ,
2626 ContainerSasPermissions , BlobClient , generate_blob_sas , BlobSasPermissions )
2727
28+ from _shared .service_versions import is_version_before , ServiceVersion
29+
2830#------------------------------------------------------------------------------
2931
3032TEST_CONTAINER_PREFIX = 'container'
3436class StorageBlobTagsTest (StorageTestCase ):
3537
3638 def _setup (self , storage_account , key ):
37- self .bsc = BlobServiceClient ( self .account_url (storage_account , "blob" ), credential = key )
39+ self .bsc = self . create_storage_client ( BlobServiceClient , self .account_url (storage_account , "blob" ), credential = key )
3840 self .container_name = self .get_resource_name ("container" )
3941 if self .is_live :
4042 container = self .bsc .get_container_client (self .container_name )
@@ -90,6 +92,7 @@ def _create_container(self, prefix="container"):
9092
9193 #-- test cases for blob tags ----------------------------------------------
9294
95+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
9396 @GlobalResourceGroupPreparer ()
9497 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
9598 def test_set_blob_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -103,6 +106,7 @@ def test_set_blob_tags(self, resource_group, location, storage_account, storage_
103106 # Assert
104107 self .assertIsNotNone (resp )
105108
109+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
106110 @pytest .mark .playback_test_only
107111 @GlobalStorageAccountPreparer ()
108112 def test_set_blob_tags_with_lease (self , resource_group , location , storage_account , storage_account_key ):
@@ -126,6 +130,7 @@ def test_set_blob_tags_with_lease(self, resource_group, location, storage_accoun
126130
127131 blob_client .delete_blob (lease = lease )
128132
133+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
129134 @pytest .mark .playback_test_only
130135 @GlobalStorageAccountPreparer ()
131136 def test_set_blob_tags_for_a_version (self , resource_group , location , storage_account , storage_account_key ):
@@ -142,6 +147,7 @@ def test_set_blob_tags_for_a_version(self, resource_group, location, storage_acc
142147 # Assert
143148 self .assertIsNotNone (resp )
144149
150+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
145151 @GlobalResourceGroupPreparer ()
146152 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
147153 def test_get_blob_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -160,6 +166,7 @@ def test_get_blob_tags(self, resource_group, location, storage_account, storage_
160166 for key , value in resp .items ():
161167 self .assertEqual (tags [key ], value )
162168
169+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
163170 @GlobalResourceGroupPreparer ()
164171 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
165172 def test_get_blob_tags_for_a_snapshot (self , resource_group , location , storage_account , storage_account_key ):
@@ -178,6 +185,7 @@ def test_get_blob_tags_for_a_snapshot(self, resource_group, location, storage_ac
178185 for key , value in resp .items ():
179186 self .assertEqual (tags [key ], value )
180187
188+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
181189 @GlobalResourceGroupPreparer ()
182190 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
183191 def test_upload_block_blob_with_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -191,6 +199,7 @@ def test_upload_block_blob_with_tags(self, resource_group, location, storage_acc
191199 self .assertIsNotNone (resp )
192200 self .assertEqual (len (resp ), 3 )
193201
202+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
194203 @GlobalResourceGroupPreparer ()
195204 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
196205 def test_get_blob_properties_returns_tags_num (self , resource_group , location , storage_account , storage_account_key ):
@@ -206,6 +215,7 @@ def test_get_blob_properties_returns_tags_num(self, resource_group, location, st
206215 self .assertEqual (resp .tag_count , len (tags ))
207216 self .assertEqual (downloaded .properties .tag_count , len (tags ))
208217
218+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
209219 @GlobalResourceGroupPreparer ()
210220 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
211221 def test_create_append_blob_with_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -219,6 +229,7 @@ def test_create_append_blob_with_tags(self, resource_group, location, storage_ac
219229 self .assertIsNotNone (resp )
220230 self .assertEqual (len (resp ), 3 )
221231
232+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
222233 @GlobalResourceGroupPreparer ()
223234 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
224235 def test_create_page_blob_with_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -232,6 +243,7 @@ def test_create_page_blob_with_tags(self, resource_group, location, storage_acco
232243 self .assertIsNotNone (resp )
233244 self .assertEqual (len (resp ), 3 )
234245
246+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
235247 @GlobalResourceGroupPreparer ()
236248 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
237249 def test_commit_block_list_with_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -255,6 +267,7 @@ def test_commit_block_list_with_tags(self, resource_group, location, storage_acc
255267 self .assertIsNotNone (resp )
256268 self .assertEqual (len (resp ), len (tags ))
257269
270+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
258271 @GlobalResourceGroupPreparer ()
259272 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
260273 def test_start_copy_from_url_with_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -284,6 +297,7 @@ def test_start_copy_from_url_with_tags(self, resource_group, location, storage_a
284297 self .assertIsNotNone (resp )
285298 self .assertEqual (len (resp ), len (tags ))
286299
300+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
287301 @GlobalResourceGroupPreparer ()
288302 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
289303 def test_list_blobs_returns_tags (self , resource_group , location , storage_account , storage_account_key ):
@@ -299,6 +313,7 @@ def test_list_blobs_returns_tags(self, resource_group, location, storage_account
299313 for key , value in blob .tags .items ():
300314 self .assertEqual (tags [key ], value )
301315
316+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
302317 @pytest .mark .playback_test_only
303318 @GlobalStorageAccountPreparer ()
304319 def test_filter_blobs (self , resource_group , location , storage_account , storage_account_key ):
@@ -328,6 +343,7 @@ def test_filter_blobs(self, resource_group, location, storage_account, storage_a
328343 self .assertEqual (items_on_page2 [0 ]['tags' ]['tag1' ], 'firsttag' )
329344 self .assertEqual (items_on_page2 [0 ]['tags' ]['tag2' ], 'secondtag' )
330345
346+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
331347 @pytest .mark .live_test_only
332348 @GlobalResourceGroupPreparer ()
333349 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
@@ -360,6 +376,7 @@ def test_filter_blobs_using_account_sas(self, resource_group, location, storage_
360376 items_on_page1 = list (first_page )
361377 self .assertEqual (1 , len (items_on_page1 ))
362378
379+ @pytest .mark .skipif (is_version_before (ServiceVersion .V2019_12_12 ), reason = "SV too low" )
363380 @pytest .mark .live_test_only
364381 @GlobalResourceGroupPreparer ()
365382 @StorageAccountPreparer (random_name_enabled = True , location = "canadacentral" , name_prefix = 'pytagstorage' )
0 commit comments