Skip to content

Commit

Permalink
Fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
samhotep committed Jun 19, 2024
1 parent 3d28ed0 commit 0fd9af0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
32 changes: 12 additions & 20 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,9 @@ def test_usns_returns_200_for_non_existing_release(self):

def test_create_usn(self):
notice = payloads.notice.copy()
notice['cves'] = ["CVE-1111-0001"]

response = self.client.post(
"/security/notices.json", json=notice
)
notice["cves"] = ["CVE-1111-0001"]

response = self.client.post("/security/notices.json", json=notice)

assert response.status_code == 200

Expand All @@ -963,18 +961,14 @@ def test_create_ssn_usn(self):

def test_create_usn_returns_422_for_non_unique_id(self):
notice = payloads.notice.copy()
notice['cves'] = ["CVE-1111-0001"]
notice["cves"] = ["CVE-1111-0001"]

# Create USN
response_1 = self.client.post(
"/security/notices.json", json=notice
)
response_1 = self.client.post("/security/notices.json", json=notice)
assert response_1.status_code == 200

# Create again
response_2 = self.client.post(
"/security/notices.json", json=notice
)
response_2 = self.client.post("/security/notices.json", json=notice)
assert response_2.status_code == 422
assert (
f"'{payloads.notice['id']}' already exists"
Expand All @@ -995,8 +989,8 @@ def test_update_usn(self):

# Create first
notice = payloads.notice.copy()
notice['cves'] = ["CVE-1111-0001"]
notice["cves"] = ["CVE-1111-0001"]

response_1 = self.client.post("/security/notices.json", json=notice)
assert response_1.status_code == 200

Expand Down Expand Up @@ -1040,11 +1034,9 @@ def test_delete_usn_returns_404_for_non_existing_usn(self):
def test_delete_usn(self):
# Create USN first
notice = payloads.notice.copy()
notice['cves'] = ["CVE-1111-0001"]

response = self.client.post(
"/security/notices.json", json=notice
)
notice["cves"] = ["CVE-1111-0001"]

response = self.client.post("/security/notices.json", json=notice)
assert response.status_code == 200

# Now delete it
Expand Down
6 changes: 3 additions & 3 deletions webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ def delete_cve(cve_id):
db.session.commit()

# Delete cve from notice_cves
delete_stmt = notice_cves.delete().where(
notice_cves.c.cve_id == cve_id
)
delete_stmt = notice_cves.delete().where(notice_cves.c.cve_id == cve_id)
db.session.execute(delete_stmt)

return make_response(
Expand Down Expand Up @@ -834,6 +832,7 @@ def _update_notice_object(notice, data):

return notice


def _update_notice_cves(notice_data, cves):
"""
Update the cves for a notice
Expand All @@ -852,6 +851,7 @@ def _update_notice_cves(notice_data, cves):
)
)


def _update_statuses(cve, data, packages):
statuses = cve.packages

Expand Down

0 comments on commit 0fd9af0

Please sign in to comment.