Buckets:
| """Tests for --offline, --disable-partner-nodes and the deprecated --disable-api-nodes""" | |
| import subprocess | |
| import sys | |
| from unittest.mock import MagicMock | |
| import pytest | |
| from aiohttp import web | |
| from aiohttp.test_utils import TestClient, TestServer | |
| from comfy.cli_args import args | |
| import server | |
| async def pong(request): | |
| return web.Response(text="pong") | |
| def parse_args(*argv): | |
| code = ( | |
| "import comfy.options; comfy.options.enable_args_parsing(); from comfy.cli_args import args; " | |
| "print(args.offline, args.disable_partner_nodes, args.disable_api_nodes)" | |
| ) | |
| out = subprocess.run([sys.executable, "-c", code, *argv], capture_output=True, text=True, check=True) | |
| return out.stdout.split()[-3:] | |
| def test_arg_parsing(argv, expected): | |
| assert parse_args(*argv) == expected | |
| async def test_csp_header(monkeypatch, offline, expect_csp): | |
| monkeypatch.setattr(args, "offline", offline) | |
| prompt_server = server.PromptServer(None, MagicMock(enabled=False)) | |
| prompt_server.app.router.add_get("/ping", pong) | |
| async with TestClient(TestServer(prompt_server.app)) as client: | |
| resp = await client.get("/ping") | |
| assert resp.status == 200 | |
| csp = resp.headers.get("Content-Security-Policy") | |
| if expect_csp: | |
| assert "connect-src 'self' data:" in csp | |
| else: | |
| assert csp is None | |
Xet Storage Details
- Size:
- 1.79 kB
- Xet hash:
- 2cf61568b249b694584291efe02606943515826dd8fdb15463f22e169df819e9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.