sherlock / simple_test.py
bangunx
πŸš€ Initial commit: Complete modular OSINT tool with Gradio interface
c7daaca
#!/usr/bin/env python3
"""
Simple test without external dependencies
"""
import json
import sys
from pathlib import Path
def test_data_loading():
"""Test if data.json can be loaded."""
try:
with open("data.json", "r") as f:
data = json.load(f)
print(f"βœ… Successfully loaded {len(data)} website configurations")
# Show a few examples
examples = list(data.keys())[:5]
print(f"πŸ“‹ Example websites: {', '.join(examples)}")
return True
except Exception as e:
print(f"❌ Failed to load data.json: {e}")
return False
def test_project_structure():
"""Test if project structure is correct."""
required_files = [
"data.json",
"app.py",
"pyproject.toml",
"requirements.txt",
"README.md",
"src/sherlock/__init__.py",
"src/sherlock/core/search_engine.py",
"src/sherlock/web/gradio_interface.py",
"src/sherlock/config/settings.py",
"src/sherlock/utils/output.py"
]
missing_files = []
for file_path in required_files:
if not Path(file_path).exists():
missing_files.append(file_path)
if missing_files:
print(f"❌ Missing files: {', '.join(missing_files)}")
return False
else:
print(f"βœ… All {len(required_files)} required files present")
return True
def main():
"""Run simple tests."""
print("πŸ§ͺ Simple Sherlock OSINT Tool Test")
print("=" * 40)
tests = [
("Project Structure", test_project_structure),
("Data Loading", test_data_loading),
]
passed = 0
for test_name, test_func in tests:
print(f"\nπŸ”„ Running {test_name} test...")
if test_func():
passed += 1
print(f"βœ… {test_name} test PASSED")
else:
print(f"❌ {test_name} test FAILED")
print("\n" + "=" * 40)
print(f"πŸ“Š Results: {passed}/{len(tests)} tests passed")
if passed == len(tests):
print("πŸŽ‰ Basic structure test passed!")
print("\nπŸ“‹ Next steps:")
print("1. Install UV: curl -LsSf https://astral.sh/uv/install.sh | sh")
print("2. Install dependencies: uv sync")
print("3. Run the tool: uv run python app.py")
else:
print("⚠️ Some tests failed. Please check the project structure.")
if __name__ == "__main__":
main()