# Path: tests/conftest.py
# def assert_cache_control(headers, cache_parts):
#     """Assert that all parts of the Cache-Control header are present."""
#     assert dict(headers) == Any.dict.containing({"Cache-Control": Any.string()})
#     assert (
#         headers["Cache-Control"].split(", ") == Any.list.containing(cache_parts).only()
#     )


import re
import pytest
from h_matchers import Any
from tests.conftest import assert_cache_control


# pylint: disable=no-value-for-parameter
# Pylint doesn't seem to understand h_matchers here for some reason


class TestStaticContent:
    @pytest.mark.parametrize(
        "url,mime_type",
        (
            ("/favicon.ico", "image/x-icon"),
            ("/js/pdfjs-init.js", "text/javascript"),
        ),
    )
    def test_get_static_content(self, url, mime_type, test_app):
        response = test_app.get(url)

        assert dict(response.headers) == Any.dict.containing(
            {"Content-Type": Any.string.containing(mime_type), "ETag": Any.string()}
        )

        assert_cache_control(response.headers, ["public", "max-age=60"])

    @pytest.mark.usefixtures("checkmate_pass")
    def test_immutable_contents(self, test_app):

        salt = self.get_salt(test_app)

        response = test_app.get(f"/static/{salt}/favicon.ico")


# Path: tests/conftest.py
# def assert_cache_control(headers, cache_parts):
#     """Assert that all parts of the Cache-Control header are present."""
#     assert dict(headers) == Any.dict.containing({"Cache-Control": Any.string()})
#     assert (
#         headers["Cache-Control"].split(", ") == Any.list.containing(cache_parts).only()
#     )


# Path: tests/functional/static_content_test.py
import re
import pytest
from h_matchers import Any
from tests.conftest import assert_cache_control



# pylint: disable=no-value-for-parameter
# Pylint doesn't seem to understand h_matchers here for some reason


class TestStaticContent:
    @pytest.mark.parametrize(
        "url,mime_type",
        (
            ("/favicon.ico", "image/x-icon"),
            ("/js/pdfjs-init.js", "text/javascript"),
        ),
    )
    def test_get_static_content(self, url, mime_type, test_app):
        response = test_app.get(url)

        assert dict(response.headers) == Any.dict.containing(
            {"Content-Type": Any.string.containing(mime_type), "ETag": Any.string()}
        )

        assert_cache_control(response.headers, ["public", "max-age=60"])

    @pytest.mark.usefixtures("checkmate_pass")
    def test_immutable_contents(self, test_app):

        salt = self.get_salt(test_app)

        response = test_app.get(f"/static/{salt}/favicon.ico")


        assert_cache_control(