<commit_before>"""Integration tests for Azure Cloud DNS"""
import re

from unittest import TestCase

from lexicon.tests.providers.integration_tests import IntegrationTests


# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interface must
# pass, by inheritance from integration_tests.IntegrationTests


class AzureTests(TestCase, IntegrationTests):
    """TestCase for Google Cloud DNS"""
    provider_name = 'azure'
    domain = 'full4ir.tk'

    def _test_parameters_overrides(self):
        return {'resource_group': 'dns-test'}

    def _filter_headers(self):
        return [('Authorization', 'Bearer TOKEN')]

    def _filter_post_data_parameters(self):
        return [('client_id', 'CLIENT_ID'), ('client_secret', 'CLIENT_SECRET')]

    def _filter_request(self, request):
        # Hide auth_tenant_id value in oauth token requests
        request.uri = re.sub(r'/[\w-]+/oauth2/token', '/TENANT_ID/oauth2/token',
                             request.uri)
        # Hide auth_subscription_id value in DNS requests
        request.uri = re.sub(r'/subscriptions/[\w-]+/', '/subscriptions/SUBSCRIPTION_ID/',
                             request.uri)
        return request

    def _filter_response(self, response):
        # Hide access_token value in oauth token responses
        response['body']['string'] = re.sub(
            r'"access_token":"[\w.-]+"', '"access_token":"TOKEN"',
            response['body']['string'])
        response['body']['string'] = re.sub(
            r'\\/subscriptions\\/[\w-]+\\/', '\\/subscriptions\\/SUBSCRIPTION_ID\\/',
            response['body']['string'])
        return response<commit_msg>Use bytes pattern in response<commit_after>"""Integration tests for Azure Cloud DNS"""
import re

from unittest import TestCase

from lexicon.tests.providers.integration_tests import IntegrationTests


# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interface must
# pass, by inheritance from integration_tests.IntegrationTests


class AzureTests(TestCase, IntegrationTests):
    """TestCase for Google Cloud DNS"""
    provider_name = 'azure'
    domain = 'full4ir.tk'

    def _test_parameters_overrides(self):
        return {'resource_group': 'dns-test'}

    def _filter_headers(self):
        return [('Authorization', 'Bearer TOKEN')]

    def _filter_post_data_parameters(self):
        return [('client_id', 'CLIENT_ID'), ('client_secret', 'CLIENT_SECRET')]

    def _filter_request(self, request):
        # Hide auth_tenant_id value in oauth token requests
        request.uri = re.sub(r'/[\w-]+/oauth2/token', '/TENANT_ID/oauth2/token',
                             request.uri)
        # Hide auth_subscription_id value in DNS requests
        request.uri = re.sub(r'/subscriptions/[\w-]+/', '/subscriptions/SUBSCRIPTION_ID/',
                             request.uri)
        return request

    def _filter_response(self, response):
        # Hide access_token value in oauth token responses
        response['body']['string'] = re.sub(
            rb'"access_token":"[\w.-]+"', '"access_token":"TOKEN"',
            response['body']['string'])
        response['body']['string'] = re.sub(
            rb'\\/subscriptions\\/[\w-]+\\/', '\\/subscriptions\\/SUBSCRIPTION_ID\\/',
            response['body']['string'])
        return response
{'fraction_non_alphanumeric': 0.13202084539664158, 'fraction_numerical': 0.0017371163867979154, 'mean_word_length': 3.003476245654693, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '233481', 'n_tokens_mistral': 1001, 'n_tokens_neox': 964, 'n_words': 241}