# Path: via/resources.py
# class PathURLResource(_URLResource):
#     """Resource for routes expecting urls from the path."""
# 
#     def url_from_path(self):
#         """Get the 'url' parameter from the path.
# 
#         :return: The URL as a string
#         :raise HTTPBadRequest: If the URL is missing or empty
#         :raise BadURL: If the URL is malformed
#         """
# 
#         url = self._request.path_qs[1:].strip()
#         if not url:
#             raise HTTPBadRequest("Required path part 'url` is missing")
# 
#         return self._normalise_url(url)
# 
# Path: via/views/proxy.py
# @view_config(route_name="proxy", renderer="via:templates/proxy.html.jinja2")
# def proxy(context, request):
#     url = context.url_from_path()
#     request.checkmate.raise_if_blocked(url)
# 
#     mime_type, _status_code = get_url_details(request.find_service(HTTPService), url)
# 
#     return {
#         "src": request.find_service(ViaClientService).url_for(
#             url, mime_type, request.params
#         )
#     }


from unittest.mock import create_autospec, sentinel
from via.resources import PathURLResource
from via.views.proxy import proxy
import pytest




class TestProxy:
    def test_it(
        self,
        context,
        pyramid_request,

# Path: via/resources.py
# class PathURLResource(_URLResource):
#     """Resource for routes expecting urls from the path."""
# 
#     def url_from_path(self):
#         """Get the 'url' parameter from the path.
# 
#         :return: The URL as a string
#         :raise HTTPBadRequest: If the URL is missing or empty
#         :raise BadURL: If the URL is malformed
#         """
# 
#         url = self._request.path_qs[1:].strip()
#         if not url:
#             raise HTTPBadRequest("Required path part 'url` is missing")
# 
#         return self._normalise_url(url)
# 
# Path: via/views/proxy.py
# @view_config(route_name="proxy", renderer="via:templates/proxy.html.jinja2")
# def proxy(context, request):
#     url = context.url_from_path()
#     request.checkmate.raise_if_blocked(url)
# 
#     mime_type, _status_code = get_url_details(request.find_service(HTTPService), url)
# 
#     return {
#         "src": request.find_service(ViaClientService).url_for(
#             url, mime_type, request.params
#         )
#     }


# Path: tests/unit/via/views/proxy_test.py
from unittest.mock import create_autospec, sentinel
from via.resources import PathURLResource
from via.views.proxy import proxy
import pytest





class TestProxy:
    def test_it(
        self,
        context,
        pyramid_request,

        get_url_details,