MCPcopy Create free account
hub / github.com/Azure/azure-storage-python / _scrub

Method _scrub

tests/testcase.py:319–343  ·  view source on GitHub ↗
(self, val)

Source from the content-addressed store, hash-verified

317 return response
318
319 def _scrub(self, val):
320 old_to_new_dict = {
321 self.settings.STORAGE_ACCOUNT_NAME: self.fake_settings.STORAGE_ACCOUNT_NAME,
322 self.settings.STORAGE_ACCOUNT_KEY: self.fake_settings.STORAGE_ACCOUNT_KEY,
323 self.settings.BLOB_STORAGE_ACCOUNT_NAME: self.fake_settings.BLOB_STORAGE_ACCOUNT_NAME,
324 self.settings.BLOB_STORAGE_ACCOUNT_KEY: self.fake_settings.BLOB_STORAGE_ACCOUNT_KEY,
325 self.settings.REMOTE_STORAGE_ACCOUNT_KEY: self.fake_settings.REMOTE_STORAGE_ACCOUNT_KEY,
326 self.settings.REMOTE_STORAGE_ACCOUNT_NAME: self.fake_settings.REMOTE_STORAGE_ACCOUNT_NAME,
327 self.settings.PREMIUM_STORAGE_ACCOUNT_NAME: self.fake_settings.PREMIUM_STORAGE_ACCOUNT_NAME,
328 self.settings.PREMIUM_STORAGE_ACCOUNT_KEY: self.fake_settings.PREMIUM_STORAGE_ACCOUNT_KEY,
329 }
330 replacements = list(old_to_new_dict.keys())
331
332 # if we have 'val1' and 'val10', we want 'val10' to be replaced first
333 replacements.sort(reverse=True)
334
335 for old_value in replacements:
336 if old_value:
337 new_value = old_to_new_dict[old_value]
338 if old_value != new_value:
339 if isinstance(val, bytes):
340 val = val.replace(old_value.encode(), new_value.encode())
341 else:
342 val = val.replace(old_value, new_value)
343 return val
344
345 def assert_upload_progress(self, size, max_chunk_size, progress, unknown_size=False):
346 '''Validates that the progress chunks align with our chunking procedure.'''

Calls

no outgoing calls

Tested by

no test coverage detected