20 lines
888 B
Python
20 lines
888 B
Python
import json
|
|
from dx_productivity.dsh.native_runtime import launch_environment, write_context
|
|
from dx_productivity.dsh.snapshot import TaskSnapshot
|
|
|
|
|
|
def test_context_publication_has_revision_and_no_unrelated_progress_fields(tmp_path):
|
|
value = write_context(tmp_path, TaskSnapshot('t', 'paused', {'completed': 2, 'api_key': 'secret'}))
|
|
assert value['revision']
|
|
assert 'secret' not in json.dumps(value)
|
|
assert json.loads((tmp_path / 'task-context.json').read_text(encoding='utf8')) == value
|
|
|
|
|
|
def test_launch_does_not_inherit_unrelated_credentials_or_user_harness_home(tmp_path, monkeypatch):
|
|
monkeypatch.setenv('OPENAI_API_KEY', 'unrelated-secret')
|
|
monkeypatch.setenv('DSH_HOME', 'unrelated-home')
|
|
env = launch_environment(tmp_path)
|
|
assert 'OPENAI_API_KEY' not in env
|
|
assert 'DSH_HOME' not in env
|
|
assert env['DX_DSH_HOME'].startswith(str(tmp_path))
|