# Path: tests/functional/matchers.py
# def temporary_redirect_to(location):
#     """Return a matcher for any `HTTP 302 Found` redirect to the given URL."""
#     return Any.instance_of(TestResponse).with_attrs(
#         {"status_code": 302, "location": location}
#     )


import pytest
from tests.functional.matchers import temporary_redirect_to



@pytest.mark.parametrize(
    "url,expected_redirect_location",
    [
        # When you submit the form on the front page it redirects you to the
        # page that will proxy the URL that you entered.
        (
            "https://example.com/foo/",
            "http://localhost/https://example.com/foo/",
        ),
        (
            "http://example.com/foo/",
            "http://localhost/http://example.com/foo/",
        ),
        # The submitted URL is normalized to strip leading/trailing spaces and
        # add a protocol.
        (
            "example.com/foo/",
            "http://localhost/https://example.com/foo/",
        ),
        # If you submit an empty form it just reloads the front page again.
        ("", "http://localhost/"),
    ],

# Path: tests/functional/matchers.py
# def temporary_redirect_to(location):
#     """Return a matcher for any `HTTP 302 Found` redirect to the given URL."""
#     return Any.instance_of(TestResponse).with_attrs(
#         {"status_code": 302, "location": location}
#     )


# Path: tests/functional/via/views/index_test.py
import pytest
from tests.functional.matchers import temporary_redirect_to




@pytest.mark.parametrize(
    "url,expected_redirect_location",
    [
        # When you submit the form on the front page it redirects you to the
        # page that will proxy the URL that you entered.
        (
            "https://example.com/foo/",
            "http://localhost/https://example.com/foo/",
        ),
        (
            "http://example.com/foo/",
            "http://localhost/http://example.com/foo/",
        ),
        # The submitted URL is normalized to strip leading/trailing spaces and
        # add a protocol.
        (
            "example.com/foo/",
            "http://localhost/https://example.com/foo/",
        ),
        # If you submit an empty form it just reloads the front page again.
        ("", "http://localhost/"),
    ],

)