mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
0bf1f02d97
- Ruff format all skill_cli and test files - Fix type: get_config_value returns str|int|None, callers cast properly - Fix type: BrowserWrapper.actions is non-optional (always provided) - Fix type: config comparison uses 'is' not '==' - Rewrite test_setup_command for new setup.handle(yes=True) API - Add None guard in test_cli_lifecycle for state file
30 lines
799 B
Python
30 lines
799 B
Python
"""Tests for setup command.
|
|
|
|
Verifies the setup command runs and returns expected structure.
|
|
"""
|
|
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
from browser_use.skill_cli.commands import setup
|
|
|
|
|
|
def test_setup_returns_valid_structure(monkeypatch):
|
|
"""Test setup handle returns expected result structure."""
|
|
with tempfile.TemporaryDirectory(prefix='bu-') as d:
|
|
monkeypatch.setenv('BROWSER_USE_HOME', d)
|
|
result = setup.handle(yes=True)
|
|
|
|
assert isinstance(result, dict)
|
|
assert 'status' in result or 'error' in result
|
|
|
|
|
|
def test_setup_creates_config(monkeypatch):
|
|
"""Test setup creates config.json."""
|
|
with tempfile.TemporaryDirectory(prefix='bu-') as d:
|
|
monkeypatch.setenv('BROWSER_USE_HOME', d)
|
|
setup.handle(yes=True)
|
|
|
|
config_path = Path(d) / 'config.json'
|
|
assert config_path.exists()
|