Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/azure_devtools/scenario_tests/recording_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ def process_response(self, response):
def _replace_subscription_id(self, val):
import re
# subscription presents in all api call
retval = re.sub('/(subscriptions)/([^/]+)/',
r'/\1/{}/'.format(self._replacement),
retval = re.sub('/(subscriptions)/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
r'/\1/{}'.format(self._replacement),
val,
flags=re.IGNORECASE)

# subscription is also used in graph call
retval = re.sub('https://(graph.windows.net)/([^/]+)/',
r'https://\1/{}/'.format(self._replacement),
retval = re.sub('https://(graph.windows.net)/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}',
r'https://\1/{}'.format(self._replacement),
retval,
flags=re.IGNORECASE)
return retval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def test_subscription_recording_processor_for_response(self):
replaced_subscription_id = str(uuid.uuid4())
rp = SubscriptionRecordingProcessor(replaced_subscription_id)

uri_templates = ['https://management.azure.com/subscriptions/{}/providers/Microsoft.ContainerRegistry/'
'checkNameAvailability?api-version=2017-03-01',
'https://graph.Windows.net/{}/applications?api-version=1.6']
body_templates = ['https://management.azure.com/subscriptions/{}/providers/Microsoft.ContainerRegistry/'
'checkNameAvailability?api-version=2017-03-01',
'https://graph.Windows.net/{}/applications?api-version=1.6',
"{{'scope':'/subscriptions/{}', 'another_data':'/Microsoft.Something'}}"]

location_header_template = 'https://graph.windows.net/{}/directoryObjects/' \
'f604c53a-aa21-44d5-a41f-c1ef0b5304bd/Microsoft.DirectoryServices.Application'
Expand All @@ -100,7 +101,7 @@ def test_subscription_recording_processor_for_response(self):
'databases/cliautomationdb01/azureAsyncOperation/' \
'6ec6196b-fbaa-415f-8c1a-6cb634a96cb2?api-version=2014-04-01-Preview'

for template in uri_templates:
for template in body_templates:
mock_sub_id = str(uuid.uuid4())
mock_response = dict({'body': {}})
mock_response['body']['string'] = template.format(mock_sub_id)
Expand Down