Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aryan@07 #2372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p align=center>
<br>
<a href="https://sherlock-project.github.io/" target="_blank"><img src="images/sherlock-logo.png"/></a>
<a href="https://sherlock-project.github.io/" target="_blank"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRc-5ujSNENxW3xta7D0DSnmCZeb_eCp5_ASgQiNBIIuGkuZ0B9axO8hoQF2SCzPTroQcM&usqp=CAU"/></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely clear on why you replaced the file path with a Google CDN URL, especially since it links to an outdated Sherlock logo, - it would be better to use the newer logo version instead.

<br>
<span>Hunt down social media accounts by username across <a href="https://sherlockproject.xyz/sites">400+ social networks</a></span>
<br>
</p>
</p>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This quote definitely should not be here, I believe you should consider removing it


<p align="center">
<a href="https://sherlockproject.xyz/installation">Installation</a>
Expand Down
44 changes: 33 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
import os
import json
import urllib
import urllib.request # Imported only `request` to avoid namespace pollution
import pytest
from sherlock_project.sites import SitesInformation

@pytest.fixture()

@pytest.fixture(scope="module") # Using `module` scope to reuse the object within a module
def sites_obj():
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json"))
"""Fixture to provide a `SitesInformation` instance."""
data_file_path = os.path.join(
os.path.dirname(__file__),
"../sherlock_project/resources/data.json"
)
if not os.path.exists(data_file_path):
raise FileNotFoundError(f"Data file not found: {data_file_path}")
sites_obj = SitesInformation(data_file_path=data_file_path)
yield sites_obj

@pytest.fixture(scope="session")
def sites_info():
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json"))
sites_iterable = {site.name: site.information for site in sites_obj}

@pytest.fixture(scope="module")
def sites_info(sites_obj):
"""Fixture to provide a dictionary of site information."""
sites_iterable = {
site.name: site.information
for site in sites_obj
}
yield sites_iterable


@pytest.fixture(scope="session")
def remote_schema():
schema_url: str = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock_project/resources/data.schema.json'
with urllib.request.urlopen(schema_url) as remoteschema:
schemadat = json.load(remoteschema)
yield schemadat
"""Fixture to fetch and load the remote schema."""
schema_url = (
"https://raw.githubusercontent.com/sherlock-project/sherlock/master/"
"sherlock_project/resources/data.schema.json"
)
try:
with urllib.request.urlopen(schema_url) as response:
if response.status != 200:
raise ConnectionError(f"Failed to fetch schema: {schema_url}")
schema_data = json.load(response)
yield schema_data
except Exception as e:
raise RuntimeError(f"Error loading remote schema: {e}")