32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import json
|
|
|
|
from src import environment
|
|
from src.decode import discovery
|
|
|
|
|
|
def test_qt_args_removes_app_specific_options():
|
|
assert environment.qt_args([
|
|
'aostats', '--verbose', '--log-path', '/tmp/capture.jsonl',
|
|
'--style', 'fusion']) == ['aostats', '--style', 'fusion']
|
|
|
|
assert environment.qt_args([
|
|
'aostats', '--log-path=/tmp/capture.jsonl']) == ['aostats']
|
|
|
|
|
|
def test_discovery_log_writes_jsonl_with_item_annotations(monkeypatch, tmp_path):
|
|
path = tmp_path / 'capture.jsonl'
|
|
monkeypatch.setattr(discovery, 'discovery_log_path', lambda: str(path))
|
|
monkeypatch.setattr(discovery, '_initialized', False)
|
|
monkeypatch.setattr(discovery.itemdb, 'get_db', lambda: {836: 'T6_STONEBLOCK'})
|
|
|
|
discovery.log('game_message', params={1: [836], 2: b'\x01'})
|
|
|
|
rows = [json.loads(line) for line in path.read_text().splitlines()]
|
|
assert rows[0]['type'] == 'session_start'
|
|
assert rows[1]['type'] == 'game_message'
|
|
assert discovery.item_candidates({1: [836]}) == [{
|
|
'path': '1[0]',
|
|
'id': 836,
|
|
'unique_name': 'T6_STONEBLOCK',
|
|
}]
|