tests: cover phase 1 commands end to end
Pytest suite with a tiny_client fixture, an ephemeral Ed25519 keypair fixture, and a threaded HTTPServer helper. Exercises cli dispatch, inspect (including excluded-path handling), build-manifest and sign against the real m2dev-client scripts, diff-remote via a local server, and the full release publish composite against a local rsync target.
This commit is contained in:
29
tests/fixtures/http_server.py
vendored
Normal file
29
tests/fixtures/http_server.py
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Minimal threaded HTTP server for diff-remote / verify-public tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import threading
|
||||
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
from typing import Iterator
|
||||
|
||||
|
||||
class _Handler(SimpleHTTPRequestHandler):
|
||||
def log_message(self, format, *args): # noqa: A002
|
||||
pass # silence
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def serve_dir(root: Path) -> Iterator[str]:
|
||||
"""Serve `root` on 127.0.0.1:<free port>, yield the base URL."""
|
||||
handler = lambda *a, **kw: _Handler(*a, directory=str(root), **kw) # noqa: E731
|
||||
server = ThreadingHTTPServer(("127.0.0.1", 0), handler)
|
||||
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
||||
thread.start()
|
||||
try:
|
||||
yield f"http://127.0.0.1:{server.server_port}"
|
||||
finally:
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
thread.join(timeout=2)
|
||||
1
tests/fixtures/tiny_client/Metin2.exe
vendored
Normal file
1
tests/fixtures/tiny_client/Metin2.exe
vendored
Normal file
@@ -0,0 +1 @@
|
||||
fake main executable content
|
||||
1
tests/fixtures/tiny_client/Metin2Launcher.exe
vendored
Normal file
1
tests/fixtures/tiny_client/Metin2Launcher.exe
vendored
Normal file
@@ -0,0 +1 @@
|
||||
fake launcher content
|
||||
1
tests/fixtures/tiny_client/readme.txt
vendored
Normal file
1
tests/fixtures/tiny_client/readme.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tiny client fixture for tests
|
||||
1
tests/fixtures/tiny_client/subdir/asset.bin
vendored
Normal file
1
tests/fixtures/tiny_client/subdir/asset.bin
vendored
Normal file
@@ -0,0 +1 @@
|
||||
asset payload bytes
|
||||
1
tests/fixtures/tiny_client/subdir/other.dat
vendored
Normal file
1
tests/fixtures/tiny_client/subdir/other.dat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
second asset payload
|
||||
Reference in New Issue
Block a user