detector package¶
Subpackages¶
Submodules¶
detector.admin module¶
detector.apps module¶
detector.forms module¶
detector.models module¶
detector.test_utilities module¶
detector.test_views module¶
- class detector.test_views.DetectorTest(methodName='runTest')[source]¶
Bases:
TestCase
This is a unit test class for testing the views of the “ai_detector” app.
- setUp()[source]¶
This method is a special method in the test case class and is executed before each test method in the class. It sets up a new client instance.
- test_ai_detector_get()[source]¶
This method tests whether the “ai_detector” view function returns a valid HTTP response with a status code of 200, and whether the response contains the expected content and uses the correct template.
- test_ai_detector_post()[source]¶
This method tests whether the “ai_detector” view function can correctly handle a POST request with the given data. It sends a POST request to the “ai_detector” URL with the given data and verifies that the response contains the expected content and the “Back to AI Detector>>>” link.
- test_ai_detector_url_is_resolved()[source]¶
This method tests whether the URL “ai_detector” is resolved correctly and whether it maps to the “ai_detector” view function.
- test_handler404()[source]¶
This method tests whether the custom 404 error page is displayed when an invalid URL is accessed. It sends a GET request to an invalid URL and verifies that the response contains the expected content and uses the correct template.
detector.urls module¶
detector.utilities module¶
detector.views module¶
- detector.views.ai_detector(request)[source]¶
This function handles requests to the AI detector page. :type name: HttpRequest object :param request: contains metadata about the request
- detector.views.index(request)[source]¶
This function handles requests to the index page. :type name: HttpRequest object :param request: contains metadata about the request
- detector.views.page_not_found(response, exception)[source]¶
This function is called whenever a page is not found (404 error) in the web application. It takes two arguments: - response: The HTTP response object. - exception: The exception that caused the 404 error.
The function renders the ‘404.html’ template and returns the response with the rendered template. This template is typically a custom error page that is displayed to the user when a page is not found.
- detector.views.server_error(response)[source]¶
This function is called whenever there is a server error (500 error) in the web application. It takes one argument: - response: The HTTP response object.
The function renders the ‘500.html’ template and returns the response with the rendered template. This template is typically a custom error page that is displayed to the user when there is a server error.