Skip to content

Commit

Permalink
Add test for default status
Browse files Browse the repository at this point in the history
  • Loading branch information
mtruj013 authored and petesfrench committed Jan 7, 2025
1 parent 6df7ae2 commit 536267e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/fixtures/payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
},
"priority": "critical",
"published": "2020-08-01 12:42:54",
"status": "not-in-ubuntu",
}

cve2 = {
Expand Down
17 changes: 17 additions & 0 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ def test_cves_query_no_500(self):

assert response.status_code == 200

def test_cves_default_status(self):
# Add new CVE without status
cve_payload = payloads.cve1.copy()

add_cve_response = self.client.put(
"/security/updates/cves.json",
json=[cve_payload],
)

assert add_cve_response.status_code == 200
response = self.client.get("/security/cves.json")

assert response.status_code == 200
# Only the CVE with the default status should be returned
assert len(response.json["cves"]) == 1
assert response.json["cves"][0]["status"] == "in-progress"

def test_cves_returns_200_for_non_existing_package_name(self):
response = self.client.get("/security/cves.json?package=no-exist")

Expand Down

0 comments on commit 536267e

Please sign in to comment.