refactor: extract test URL constant for better maintainability

Address code review feedback by extracting the hardcoded test URL
into a module-level constant to improve maintainability and ensure
consistency across all test methods.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-11 18:24:03 +00:00
parent fad63fcf4b
commit 8c5ab00428
+6 -3
View File
@@ -7,6 +7,9 @@ that endpoints remain accessible after code refactoring or reorganization.
import pytest import pytest
# Test constants
TEST_URL = "https://example.com/test.pdf"
@pytest.mark.unit @pytest.mark.unit
class TestEndpointRegistration: class TestEndpointRegistration:
@@ -17,7 +20,7 @@ class TestEndpointRegistration:
# Make a request to the endpoint - it should not return 404 # Make a request to the endpoint - it should not return 404
response = client.post( response = client.post(
"/api/process-url", "/api/process-url",
json={"url": "https://example.com/test.pdf"} json={"url": TEST_URL}
) )
# The endpoint exists if we don't get a 404 # The endpoint exists if we don't get a 404
@@ -34,7 +37,7 @@ class TestEndpointRegistration:
# Try POST request # Try POST request
response = client.post( response = client.post(
"/api/process-url", "/api/process-url",
json={"url": "https://example.com/test.pdf"} json={"url": TEST_URL}
) )
# Should not return 405 (Method Not Allowed) # Should not return 405 (Method Not Allowed)
@@ -55,7 +58,7 @@ class TestEndpointRegistration:
if method == "get": if method == "get":
response = client.get(endpoint) response = client.get(endpoint)
else: else:
response = client.post(endpoint, json={"url": "https://example.com/test.pdf"}) response = client.post(endpoint, json={"url": TEST_URL})
# None of these should return 404 # None of these should return 404
assert response.status_code != 404, ( assert response.status_code != 404, (