# Path: oslo_middleware/stats.py
# LOG = logging.getLogger(__name__)
# VERSION_REGEX = re.compile(r"/(v[0-9]{1}\.[0-9]{1})")
# UUID_REGEX = re.compile(
#     r'.*(\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}).*a',
#     re.IGNORECASE)
# SHORT_UUID_REGEX = re.compile(r'.*(\.[0-9a-fA-F]{32}).*')
# class StatsMiddleware(base.ConfigurableMiddleware):
#     def __init__(self, application, conf):
#     def strip_short_uuid(path):
#     def strip_uuid(path):
#     def strip_dot_from_version(path):
#     def __call__(self, request):


from unittest import mock
from oslotest import base as test_base
from oslo_middleware import stats
import uuid
import statsd
import webob.dec
import webob.exc
# Copyright (c) 2016 Cisco Systems
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TestStaticMethods(test_base.BaseTestCase):

    def test_removes_uuid(self):
        # Generate a long-format UUID (standard form).
        id = str(uuid.uuid4())
        path = "foo.{uuid}.bar".format(uuid=id)
        stat = stats.StatsMiddleware.strip_uuid(path)
        self.assertEqual("foo.bar", stat)

    def test_removes_short_uuid(self):
        id = uuid.uuid4().hex
        path = "foo.{uuid}.bar".format(uuid=id)

# Path: oslo_middleware/stats.py
# LOG = logging.getLogger(__name__)
# VERSION_REGEX = re.compile(r"/(v[0-9]{1}\.[0-9]{1})")
# UUID_REGEX = re.compile(
#     r'.*(\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}).*a',
#     re.IGNORECASE)
# SHORT_UUID_REGEX = re.compile(r'.*(\.[0-9a-fA-F]{32}).*')
# class StatsMiddleware(base.ConfigurableMiddleware):
#     def __init__(self, application, conf):
#     def strip_short_uuid(path):
#     def strip_uuid(path):
#     def strip_dot_from_version(path):
#     def __call__(self, request):


# Path: oslo_middleware/tests/test_stats.py
from unittest import mock
from oslotest import base as test_base
from oslo_middleware import stats
import uuid
import statsd
import webob.dec
import webob.exc

# Copyright (c) 2016 Cisco Systems
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TestStaticMethods(test_base.BaseTestCase):

    def test_removes_uuid(self):
        # Generate a long-format UUID (standard form).
        id = str(uuid.uuid4())
        path = "foo.{uuid}.bar".format(uuid=id)
        stat = stats.StatsMiddleware.strip_uuid(path)
        self.assertEqual("foo.bar", stat)

    def test_removes_short_uuid(self):
        id = uuid.uuid4().hex
        path = "foo.{uuid}.bar".format(uuid=id)

        stat = stats.StatsMiddleware.strip_short_uuid(path)