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

shashank@3540 #2370

Open
wants to merge 2 commits 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
75 changes: 55 additions & 20 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,97 @@
name: Bug report
description: File a bug report
labels: ["bug"]
name: Bug Report
description: Report a bug or unexpected behavior
labels: ["bug", "needs triage"]
body:
- type: dropdown
id: package
attributes:
label: Installation method
label: Installation Method
description: |
Some packages are maintained by the community, rather than by the Sherlock Project.
Knowing which packages are affected helps us diagnose package-specific bugs.
Select the method used to install the software. Knowing the installation method helps diagnose package-specific bugs.
options:
- Select one
- PyPI (via pip)
- Homebrew
- Docker
- Kali repository (via apt)
- Built from source
- Other (indicate below)
- Other (please specify below)
validations:
required: true

- type: input
id: version
attributes:
label: Software Version
description: |
Specify the version of the software you are using. If you are unsure, please type "Unknown."
placeholder: e.g., v1.2.3
validations:
required: true

- type: textarea
id: description
attributes:
label: Description
label: Bug Description
description: |
Detailed descriptions that help contributors understand and reproduce your bug are much more likely to lead to a fix.
Please include the following information:
- What you were trying to do
Provide a detailed description of the bug. Clearly describe:
- What you were trying to accomplish
- What you expected to happen
- What actually happened
- What actually occurred
- Why you think this is an issue
placeholder: |
When doing {action}, the expected result should be {expected result}.
When doing {action}, however, the actual result was {actual result}.
This is undesirable because {reason}.
However, the actual result was {actual result}.
This behavior is problematic because {reason}.
validations:
required: true

- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: Write a step by step list that will allow us to reproduce this bug.
label: Steps to Reproduce
description: |
Provide a step-by-step guide that someone else can follow to recreate the issue. Include as much detail as possible.
placeholder: |
1. Do something
2. Then do something else
3. Observe the issue
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: Describe what you expected to happen if the bug did not occur.
placeholder: Describe the expected output or behavior.
validations:
required: true

- type: textarea
id: actual-behavior
attributes:
label: Actual Behavior
description: Describe what actually happened, including any error messages.
placeholder: Describe the actual output or behavior.
validations:
required: true

- type: textarea
id: additional-info
attributes:
label: Additional information
description: If you have some additional information, please write it here.
label: Additional Information
description: Include any other details you think might be relevant, such as error logs, screenshots, or code snippets.
placeholder: Additional context, error logs, screenshots, etc.
validations:
required: false

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/sherlock-project/sherlock/blob/master/docs/CODE_OF_CONDUCT.md).
label: Code of Conduct Agreement
description: |
By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/sherlock-project/sherlock/blob/master/docs/CODE_OF_CONDUCT.md).
options:
- label: I agree to follow this project's Code of Conduct
required: true
46 changes: 39 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,52 @@
import pytest
from sherlock_project.sites import SitesInformation


# Fixture to initialize a SitesInformation object
@pytest.fixture()
def sites_obj():
sites_obj = SitesInformation(data_file_path=os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json"))
yield sites_obj
"""
Fixture for creating a SitesInformation instance with data loaded from the local JSON file.
"""
data_file = os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json")
if not os.path.exists(data_file):
raise FileNotFoundError(f"Data file not found: {data_file}")
yield SitesInformation(data_file_path=data_file)


# Fixture to provide site information as a dictionary (session-wide)
@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"))
"""
Fixture that provides site information as a dictionary of site names to site details.
"""
data_file = os.path.join(os.path.dirname(__file__), "../sherlock_project/resources/data.json")
if not os.path.exists(data_file):
raise FileNotFoundError(f"Data file not found: {data_file}")

sites_obj = SitesInformation(data_file_path=data_file)
sites_iterable = {site.name: site.information for site in sites_obj}
yield sites_iterable


# Fixture to fetch and load the remote schema file
@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 parse the remote JSON schema for site data validation.
"""
schema_url = 'https://raw.githubusercontent.com/sherlock-project/sherlock/master/sherlock_project/resources/data.schema.json'
try:
with urllib.request.urlopen(schema_url) as remoteschema:
schemadat = json.load(remoteschema)
yield schemadat
except urllib.error.URLError as e:
raise ConnectionError(f"Unable to fetch schema from {schema_url}: {e}")
except json.JSONDecodeError as e:
raise ValueError(f"Error decoding JSON from {schema_url}: {e}")


# Utility function to check if the data file exists
def validate_data_file(path):
if not os.path.exists(path):
raise FileNotFoundError(f"Data file does not exist: {path}")