Skip to content

Commit

Permalink
fixing environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jyang2139 committed Feb 4, 2025
1 parent 76d2a92 commit ebd4add
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions integration/tests/test_vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests

# Configuration
BASE_URL = "http://localhost:3000"
BASE_URL = os.environ.get("BACKEND_DOMAIN")
X_API_KEY = os.environ.get("X_API_KEY")
BAD_ID = "c0effe93-3647-475a-a0c5-0b629c348590"

Expand All @@ -32,11 +32,13 @@ def get_vulnerabilities():
return data["result"]


vulnerabilities = get_vulnerabilities()


# mark tests with integration tag, run with pytest -m integration
@pytest.mark.integration
def test_get_vulnerability_by_id():
"""Test get vulnerability by ID."""
vulnerabilities = get_vulnerabilities()
select_vulnerability = random.choice(vulnerabilities)
vulnerability_id = select_vulnerability["id"]
url = f"{BASE_URL}/vulnerabilities/{vulnerability_id}"
Expand Down Expand Up @@ -105,7 +107,6 @@ def test_search_vulnerabilities():
def test_get_update_and_revert_vulnerability_by_id():
"""Test get vulnerability by ID, update fields, and revert back to original."""
# Step 1: Retrieve the original data using GET
vulnerabilities = get_vulnerabilities()
select_vulnerability = random.choice(vulnerabilities)
vulnerability_id = select_vulnerability["id"]
url = f"{BASE_URL}/vulnerabilities/{vulnerability_id}"
Expand Down Expand Up @@ -215,7 +216,6 @@ def test_update_vulnerability_by_id_fails_404():
@pytest.mark.integration
def test_update_vulnerability_by_id_fails_422():
"""Test update vulnerability by ID fails with 422 due to invalid payload."""
vulnerabilities = get_vulnerabilities()
select_vulnerability = random.choice(vulnerabilities)
vulnerability_id = select_vulnerability["id"]
url = f"{BASE_URL}/vulnerabilities/{vulnerability_id}"
Expand Down

0 comments on commit ebd4add

Please sign in to comment.