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

@@ -44,7 +44,7 @@ class TestQueryCommand:
Issue #14: SQL query interface with safety constraints
"""
# Test that the main query command exists and is callable
result = self.runner.invoke(cli, ['query', '--help'])
result = self.runner.invoke(cli, ['db-query', '--help'])
assert result.exit_code == 0
assert 'query' in result.output.lower()
assert 'execute sql query' in result.output.lower() or 'sql' in result.output.lower()
@@ -64,7 +64,7 @@ class TestQueryCommand:
{'id': 1, 'filename': 'test.md', 'created_at': '2025-09-25'}
]
result = self.runner.invoke(cli, ['query', 'SELECT * FROM markdown_files LIMIT 1'])
result = self.runner.invoke(cli, ['db-query', 'SELECT * FROM markdown_files LIMIT 1'])
assert result.exit_code == 0
assert 'test.md' in result.output
@@ -85,7 +85,7 @@ class TestQueryCommand:
]
for dangerous_sql in dangerous_queries:
result = self.runner.invoke(cli, ['query', dangerous_sql])
result = self.runner.invoke(cli, ['db-query', dangerous_sql])
assert result.exit_code != 0
assert ('not allowed' in result.output.lower() or
'allowed' in result.output.lower() or
@@ -106,7 +106,7 @@ class TestQueryCommand:
# Mock empty result
mock_db_instance.execute_query.return_value = []
result = self.runner.invoke(cli, ['query', 'SELECT * FROM markdown_files WHERE id = -1'])
result = self.runner.invoke(cli, ['db-query', 'SELECT * FROM markdown_files WHERE id = -1'])
assert result.exit_code == 0
assert 'no results' in result.output.lower() or len(result.output.strip()) == 0
@@ -124,7 +124,7 @@ class TestQueryCommand:
# Mock SQL error
mock_db_instance.execute_query.side_effect = Exception("SQL syntax error")
result = self.runner.invoke(cli, ['query', 'SELECT * FROM nonexistent_table'])
result = self.runner.invoke(cli, ['db-query', 'SELECT * FROM nonexistent_table'])
assert result.exit_code != 0
assert 'error' in result.output.lower()
@@ -143,7 +143,7 @@ class TestSchemaCommand:
Issue #14: Schema inspection commands
"""
result = self.runner.invoke(cli, ['schema', '--help'])
result = self.runner.invoke(cli, ['db-schema', '--help'])
assert result.exit_code == 0
assert 'schema' in result.output.lower()
assert ('database' in result.output.lower() or
@@ -173,7 +173,7 @@ class TestSchemaCommand:
}
}
result = self.runner.invoke(cli, ['schema'])
result = self.runner.invoke(cli, ['db-schema'])
assert result.exit_code == 0
assert 'markdown_files' in result.output
@@ -198,11 +198,11 @@ class TestSchemaCommand:
mock_db_instance.get_schema.return_value = mock_schema
# Test JSON format
result = self.runner.invoke(cli, ['schema', '--format', 'json'])
result = self.runner.invoke(cli, ['db-schema', '--format', 'json'])
assert result.exit_code == 0
# Test YAML format
result = self.runner.invoke(cli, ['schema', '--format', 'yaml'])
result = self.runner.invoke(cli, ['db-schema', '--format', 'yaml'])
assert result.exit_code == 0
@@ -346,7 +346,7 @@ class TestQuerySafety:
for operation in write_operations:
query = f"{operation} markdown_files"
result = runner.invoke(cli, ['query', query])
result = runner.invoke(cli, ['db-query', query])
# Should be rejected
assert result.exit_code != 0 or 'not allowed' in result.output.lower()
@@ -364,7 +364,7 @@ class TestQueryTemplates:
runner = CliRunner()
# Test that templates or examples are shown in help
result = runner.invoke(cli, ['query', '--help'])
result = runner.invoke(cli, ['db-query', '--help'])
assert result.exit_code == 0
# Should mention examples or templates
@@ -393,5 +393,5 @@ class TestQueryTemplates:
]
for query in common_queries:
result = runner.invoke(cli, ['query', query])
result = runner.invoke(cli, ['db-query', query])
assert result.exit_code == 0