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

Missing Test Coverage for ask_analysis_availability API View #2579

Open
n-strong opened this issue Nov 23, 2024 · 0 comments
Open

Missing Test Coverage for ask_analysis_availability API View #2579

n-strong opened this issue Nov 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@n-strong
Copy link

Issue: Missing Test Coverage for ask_analysis_availability API View
What happened

The ask_analysis_availability API view currently lacks comprehensive test coverage. This absence of tests may lead to undetected bugs and regressions in future updates, affecting the reliability of the API endpoint.
Environment

OS: Linux Mint 21.3
IntelOwl version: v6.1.0

What did you expect to happen

I expected the ask_analysis_availability API view to have thorough unit tests covering various scenarios to ensure its correct functionality and to prevent potential issues during development and deployment.
How to reproduce your issue

Not applicable—this issue pertains to missing test cases rather than a runtime error.
Error messages and logs

There are no error messages or logs since this is about adding missing test cases.
Suggested Test Cases for ask_analysis_availability API View

Valid Request
    Test Scenario: Provide a valid MD5 hash and analyzer details.
    Expected Result: Receive a 200 OK response with the correct data.

Missing Fields
    Test Scenario: Submit a request without the required md5 field.
    Expected Result: Receive a 400 Bad Request response indicating the missing fields.

Unauthorized Access
    Test Scenario: Attempt to access the endpoint without authentication.
    Expected Result: Receive a 401 Unauthorized response, ensuring that only authenticated users can access the endpoint.

Implementation Details

Testing Tool: Use APIClient from rest_framework.test to simulate POST requests.
Test Methods: Create separate test methods for each scenario to maintain clarity and organization.
Assertions: Check both response status codes and content to verify that the API behaves as expected.
@n-strong n-strong added the bug Something isn't working label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant