File size: 2,469 Bytes
c7daaca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | #!/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()
|