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

Method get_resource_name

tests/testcase.py:87–100  ·  view source on GitHub ↗
(self, prefix='')

Source from the content-addressed store, hash-verified

85 return self.test_mode == TestMode.playback
86
87 def get_resource_name(self, prefix=''):
88 # Append a suffix to the name, based on the fully qualified test name
89 # We use a checksum of the test name so that each test gets different
90 # resource names, but each test will get the same name on repeat runs,
91 # which is needed for playback.
92 # Most resource names have a length limit, so we use a crc32
93 if self.test_mode.lower() == TestMode.run_live_no_record.lower():
94 return prefix + str(uuid.uuid4()).replace('-', '')
95 else:
96 checksum = zlib.adler32(self.qualified_test_name.encode()) & 0xffffffff
97 name = '{}{}'.format(prefix, hex(checksum)[2:])
98 if name.endswith('L'):
99 name = name[:-1]
100 return name
101
102 def get_random_bytes(self, size):
103 if self.test_mode.lower() == TestMode.run_live_no_record.lower():

Callers 15

setUpMethod · 0.80
_get_blob_referenceMethod · 0.80
setUpMethod · 0.80
_get_blob_referenceMethod · 0.80
setUpMethod · 0.80
setUpMethod · 0.80
_get_blob_referenceMethod · 0.80
setUpMethod · 0.80
_get_blob_referenceMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected