ArchiveBox/tests/test_cli_server.py
Nick Sweeting 30c60eef76
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Deploy static content to Pages / deploy (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Parallel Tests / Discover test files (push) Waiting to run
Parallel Tests / ${{ matrix.test.name }} (push) Blocked by required conditions
Run tests / python_tests (ubuntu-22.04, 3.13) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run
much better tests and add page ui
2025-12-29 04:02:11 -08:00

46 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""
Tests for archivebox server command.
Verify server can start (basic smoke tests only, no full server testing).
"""
import os
import subprocess
import signal
import time
from .fixtures import *
def test_server_shows_usage_info(tmp_path, process):
"""Test that server command shows usage or starts."""
os.chdir(tmp_path)
# Just check that the command is recognized
# We won't actually start a full server in tests
result = subprocess.run(
['archivebox', 'server', '--help'],
capture_output=True,
text=True,
timeout=10,
)
assert result.returncode == 0
assert 'server' in result.stdout.lower() or 'http' in result.stdout.lower()
def test_server_init_flag(tmp_path, process):
"""Test that --init flag runs init before starting server."""
os.chdir(tmp_path)
# Check init flag is recognized
result = subprocess.run(
['archivebox', 'server', '--help'],
capture_output=True,
text=True,
timeout=10,
)
assert result.returncode == 0
assert '--init' in result.stdout or 'init' in result.stdout.lower()