feat(dsh): add CAD verification recovery diff and issue broker
This commit is contained in:
1 parent
eee4e6bde9
commit
27334fef81
23 files changed
+553
-12
No files matched your search
@@ -8,7 +8,7 @@ TARGET = {'server': 'https://git.test', 'repository': 'owner/repo'}
|
||||
|
||||
def test_transport_uses_short_lived_broker_credential_without_caching_token(tmp_path, monkeypatch):
|
||||
config = tmp_path / 'issue-config.json'
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange', 'instance_id': 'machine-1'}), encoding='utf8')
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange', 'instance_id': 'machine-1', 'instance_proof': 'proof', 'idempotency_key': 'event-1'}), encoding='utf8')
|
||||
monkeypatch.setattr('dx_productivity.dsh.issue_transport._post_broker', lambda *args, **kwargs: {'token': 'short-secret', 'expires_in': 120})
|
||||
value = IssueTransport(config).credentials(TARGET)
|
||||
assert value['source'] == 'broker'
|
||||
@@ -29,7 +29,7 @@ def test_transport_marks_bootstrap_fallback_for_rotation(tmp_path, monkeypatch):
|
||||
|
||||
def test_transport_rejects_target_before_broker_or_credentials(tmp_path, monkeypatch):
|
||||
config = tmp_path / 'issue-config.json'
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange'}), encoding='utf8')
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange', 'instance_id': 'machine-1', 'instance_proof': 'proof', 'idempotency_key': 'event-1'}), encoding='utf8')
|
||||
monkeypatch.setattr('dx_productivity.dsh.issue_transport._post_broker', lambda *args, **kwargs: (_ for _ in ()).throw(AssertionError('network called')))
|
||||
value = IssueTransport(config).credentials({'server': 'https://evil.test', 'repository': 'owner/repo'})
|
||||
assert value['source'] == 'invalid_target'
|
||||
@@ -39,7 +39,7 @@ def test_transport_rejects_target_before_broker_or_credentials(tmp_path, monkeyp
|
||||
def test_git_publisher_connection_prefers_broker_transport(tmp_path, monkeypatch):
|
||||
from dx_productivity.dsh.git_issues import GitIssuePublisher
|
||||
config = tmp_path / 'issue-config.json'
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange'}), encoding='utf8')
|
||||
config.write_text(json.dumps({**TARGET, 'broker_url': 'https://broker.test/exchange', 'instance_id': 'machine-1', 'instance_proof': 'proof', 'idempotency_key': 'event-1'}), encoding='utf8')
|
||||
monkeypatch.setattr('dx_productivity.dsh.issue_transport._post_broker', lambda *args, **kwargs: {'token': 'ephemeral', 'expires_in': 60})
|
||||
_, headers, source = GitIssuePublisher(config).connection()
|
||||
assert headers == {'Authorization': 'token ephemeral'}
|
||||
|
||||
Reference in new issue
Block a user