refactor: Remove deprecated query and schema commands and update all tests
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled

- Remove deprecated 'query' command (replaced by 'db-query')
- Remove deprecated 'schema' command (replaced by 'db-schema')
- Remove 4 obsolete tests that tested deprecated functionality
- Update all remaining tests to use new db-prefixed command names
- CLI now has clean, consistent command structure with proper prefixes
- All 478 tests passing after cleanup

This completes the CLI consistency convention implementation where all
subsystem commands follow the "*-stats" pattern and use proper prefixes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-30 23:33:43 +02:00
parent 3222a474c9
commit c25795fb79
6 changed files with 25 additions and 204 deletions

View File

@@ -78,47 +78,6 @@ class TestIssue39DatabaseCommandReorganization:
assert 'markdown_files' in result.output
mock_db_instance.get_schema.assert_called_once()
def test_old_query_command_shows_deprecation_warning_but_works(self, runner):
"""
Test backward compatibility: old query command works with deprecation warning.
Issue #39: Backward compatibility requirement
"""
with patch('markitect.cli.DatabaseManager') as mock_db_mgr:
mock_db_instance = MagicMock()
mock_db_mgr.return_value = mock_db_instance
mock_db_instance.execute_query.return_value = [{'count': 3}]
result = runner.invoke(cli, [
'query', 'SELECT COUNT(*) as count FROM markdown_files'
])
assert result.exit_code == 0
# Should work but show deprecation warning
assert 'deprecated' in result.output.lower() or 'deprecat' in result.output.lower()
assert 'db-query' in result.output
mock_db_instance.execute_query.assert_called_once()
def test_old_schema_command_shows_deprecation_warning_but_works(self, runner):
"""
Test backward compatibility: old schema command works with deprecation warning.
Issue #39: Backward compatibility requirement
"""
with patch('markitect.cli.DatabaseManager') as mock_db_mgr:
mock_db_instance = MagicMock()
mock_db_mgr.return_value = mock_db_instance
mock_db_instance.get_schema.return_value = {
'markdown_files': {'columns': []}
}
result = runner.invoke(cli, ['schema'])
assert result.exit_code == 0
# Should work but show deprecation warning
assert 'deprecated' in result.output.lower() or 'deprecat' in result.output.lower()
assert 'db-schema' in result.output
mock_db_instance.get_schema.assert_called_once()
def test_db_delete_command_exists_and_requires_confirmation(self, runner, temp_dir):
"""
@@ -270,25 +229,6 @@ class TestIssue39BackwardCompatibility:
def runner(self):
return CliRunner()
def test_existing_scripts_continue_to_work(self, runner):
"""
Test that existing scripts using old command names continue to work.
Issue #39: Backward compatibility requirement
"""
with patch('markitect.cli.DatabaseManager') as mock_db_mgr:
mock_db_instance = MagicMock()
mock_db_mgr.return_value = mock_db_instance
mock_db_instance.execute_query.return_value = []
mock_db_instance.get_schema.return_value = {}
# Old commands should still work
query_result = runner.invoke(cli, ['query', 'SELECT 1'])
schema_result = runner.invoke(cli, ['schema'])
# Both should work (exit code 0) even if they show warnings
assert query_result.exit_code == 0
assert schema_result.exit_code == 0
def test_no_breaking_changes_to_command_arguments(self, runner):
"""