From 1aa56a56b54b155ebc7e1de8f78cdfad4d6cfa3c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Nov 2025 00:32:50 +0000 Subject: [PATCH] fix: Update version to 0.3.0 and fix failing tests - Update package version from 0.2.0 to 0.3.0 in __init__.py - Fix test_fallback_info_success to check spec version instead of package version - Fix test_fallback_version to expect 0.3.0 - Fix DID web integration test: - Update signature format to include 'ed25519:' prefix - Update DID document key ID to use default '#keys-1' - Fix mock to use Ed25519PublicKey.from_public_bytes - Fix context parameter type All 318 tests now passing with 71% code coverage. --- genesisgraph/__init__.py | 2 +- tests/test_cli.py | 4 ++-- tests/test_did_web_integration.py | 16 ++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/genesisgraph/__init__.py b/genesisgraph/__init__.py index 3d16572..a19c87f 100644 --- a/genesisgraph/__init__.py +++ b/genesisgraph/__init__.py @@ -4,7 +4,7 @@ An open standard for proving how things were made. """ -__version__ = "0.2.0" +__version__ = "0.3.0" from .validator import GenesisGraphValidator, validate from .errors import ( diff --git a/tests/test_cli.py b/tests/test_cli.py index d512c72..1ac3540 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -225,7 +225,7 @@ def test_fallback_info_success(self, info_gg_file, capsys): assert exc_info.value.code == 0 captured = capsys.readouterr() - assert '0.2.0' in captured.out + assert 'Spec version: 0.1.0' in captured.out # Check spec version from document assert 'gg-ai-basic-v1' in captured.out def test_fallback_version(self, capsys): @@ -238,7 +238,7 @@ def test_fallback_version(self, capsys): assert exc_info.value.code == 0 captured = capsys.readouterr() assert 'GenesisGraph' in captured.out - assert '0.2.0' in captured.out + assert '0.3.0' in captured.out def test_fallback_no_args(self, capsys): """Test fallback CLI with no arguments""" diff --git a/tests/test_did_web_integration.py b/tests/test_did_web_integration.py index 0686070..69b3cf1 100644 --- a/tests/test_did_web_integration.py +++ b/tests/test_did_web_integration.py @@ -150,7 +150,7 @@ def test_end_to_end_signature_verification_with_did_web(self, mock_http_response did_document = { "id": "did:web:hospital.example.com", "verificationMethod": [{ - "id": "did:web:hospital.example.com#signing-key", + "id": "did:web:hospital.example.com#keys-1", "type": "Ed25519VerificationKey2020", "controller": "did:web:hospital.example.com", "publicKeyBase58": base58_encode(test_public_key) @@ -164,13 +164,13 @@ def test_end_to_end_signature_verification_with_did_web(self, mock_http_response # Mock ed25519 verification with patch('genesisgraph.validator.ed25519') as mock_ed25519: mock_verify = Mock() - mock_ed25519.VerifyingKey.from_bytes.return_value = mock_verify + mock_ed25519.Ed25519PublicKey.from_public_bytes.return_value = mock_verify validator = GenesisGraphValidator(verify_signatures=True) attestation = { 'signer': 'did:web:hospital.example.com', - 'signature': base64.b64encode(b'fake_signature' * 8).decode(), + 'signature': f'ed25519:{base64.b64encode(b"fake_signature" * 8).decode()}', 'timestamp': '2025-10-15T14:30:00Z' } @@ -181,15 +181,19 @@ def test_end_to_end_signature_verification_with_did_web(self, mock_http_response 'outputs': [] } - context = {'operation_id': 'op_test_001'} + context = 'Operation op_test_001' # This should resolve did:web and attempt verification - validator._verify_signature(attestation, operation_data, context) + errors = validator._verify_signature(attestation, operation_data, context) + + # Print errors for debugging + if errors: + print(f"Verification errors: {errors}") # Verify DID was resolved mock_get.assert_called_once() # Verify ed25519 verification was attempted with correct key - mock_ed25519.VerifyingKey.from_bytes.assert_called_once_with(test_public_key) + mock_ed25519.Ed25519PublicKey.from_public_bytes.assert_called_once_with(test_public_key) def test_multiple_verification_methods(self, mock_http_response, base58_encode): """Test DID document with multiple keys, selecting specific one"""