(self, prefix='')
| 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(): |
no outgoing calls
no test coverage detected