|
|
|
|
|
""" |
|
|
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") |
|
|
|
|
|
|
|
|
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() |
|
|
|