Skip to content

Commit

Permalink
Appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mtruj013 committed Feb 22, 2024
1 parent 7e71ae1 commit 8e67476
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
3 changes: 1 addition & 2 deletions tests/fixtures/payloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@
}



release3 = {
"name": "Another Created Release",
"version": "99.06",
Expand All @@ -306,4 +305,4 @@
"release_date": "2021-04-22",
"esm_expires": "2022-01-31",
"support_expires": "2022-01-31",
}
}
55 changes: 35 additions & 20 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def test_cves_returns_200_for_non_existing_version(self):
)

def test_cves_filtered_by_existing_version(self):
# Add releases because the DB only includes 1 release upon initialization
# Add releases because the DB only
# includes 1 release upon initialization
add_release_response = self.client.post(
"/security/releases.json", json=payloads.release
)
Expand All @@ -156,7 +157,7 @@ def test_cves_filtered_by_existing_version(self):
assert add_release2_response.status_code == 200
assert add_release3_response.status_code == 200

# Add cves with different statuses because the
# Add cves with different statuses because the
# DB only includes 1 cve upon initialization
add_cves_response = self.client.put(
"/security/cves.json",
Expand All @@ -172,13 +173,15 @@ def test_cves_filtered_by_existing_version(self):
)
assert add_cves_response.status_code == 200

filtered_cves_response = self.client.get("/security/cves.json?version=testrelease")
filtered_cves_response = self.client.get(
"/security/cves.json?version=testrelease"
)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 5

def text_cves_filtered_by_existing_status(self):
# Add cves with different statuses because the
# Add cves with different statuses because the
# DB only includes 1 cve upon initialization
add_cves_response = self.client.put(

Check warning on line 186 in tests/test_routes.py

View check run for this annotation

Codecov / codecov/patch

tests/test_routes.py#L186

Added line #L186 was not covered by tests
"/security/cves.json",
Expand All @@ -194,13 +197,16 @@ def text_cves_filtered_by_existing_status(self):
)
assert add_cves_response.status_code == 200

Check warning on line 198 in tests/test_routes.py

View check run for this annotation

Codecov / codecov/patch

tests/test_routes.py#L198

Added line #L198 was not covered by tests

filtered_cves_response = self.client.get("/security/cves.json?status=released")
filtered_cves_response = self.client.get(

Check warning on line 200 in tests/test_routes.py

View check run for this annotation

Codecov / codecov/patch

tests/test_routes.py#L200

Added line #L200 was not covered by tests
"/security/cves.json?status=released"
)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 6

Check warning on line 205 in tests/test_routes.py

View check run for this annotation

Codecov / codecov/patch

tests/test_routes.py#L204-L205

Added lines #L204 - L205 were not covered by tests

def test_cves_filtered_by_multiple_statuses(self):
# Add releases because the DB only includes 1 release upon initialization
# Add releases because the DB only includes
# 1 release upon initialization
add_release_response = self.client.post(
"/security/releases.json", json=payloads.release
)
Expand All @@ -215,7 +221,7 @@ def test_cves_filtered_by_multiple_statuses(self):
assert add_release2_response.status_code == 200
assert add_release3_response.status_code == 200

# Add cves with different statuses because the
# Add cves with different statuses because the
# DB only includes 1 cve upon initialization
add_cves_response = self.client.put(
"/security/cves.json",
Expand All @@ -232,13 +238,16 @@ def test_cves_filtered_by_multiple_statuses(self):

assert add_cves_response.status_code == 200

filtered_cves_response = self.client.get("/security/cves.json?status=needed&status=needs-triage")

filtered_cves_response = self.client.get(
"/security/cves.json?status=needed&status=needs-triage"
)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 2

def test_cves_filtered_by_multiple_versions(self):
# Add releases because the DB only includes 1 release upon initialization
# Add releases because the DB only includes
# 1 release upon initialization
add_release_response = self.client.post(
"/security/releases.json", json=payloads.release
)
Expand All @@ -252,8 +261,8 @@ def test_cves_filtered_by_multiple_versions(self):
assert add_release_response.status_code == 200
assert add_release2_response.status_code == 200
assert add_release3_response.status_code == 200
# Add cves with different statuses because the

# Add cves with different statuses because the
# DB only includes 1 cve upon initialization
add_cves_response = self.client.put(
"/security/cves.json",
Expand All @@ -270,13 +279,16 @@ def test_cves_filtered_by_multiple_versions(self):

assert add_cves_response.status_code == 200

filtered_cves_response = self.client.get("/security/cves.json?version=testrelease3&version=testrelease2")
filtered_cves_response = self.client.get(
"/security/cves.json?version=testrelease3&version=testrelease2"
)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 3

def test_cves_filtered_by_status_and_version(self):
# Add releases because the DB only includes 1 release upon initialization
# Add releases because the DB only includes
# 1 release upon initialization
add_release_response = self.client.post(
"/security/releases.json", json=payloads.release
)
Expand All @@ -291,7 +303,7 @@ def test_cves_filtered_by_status_and_version(self):
assert add_release2_response.status_code == 200
assert add_release3_response.status_code == 200

# Add cves with different statuses because the
# Add cves with different statuses because the
# DB only includes 1 cve upon initialization
add_cves_response = self.client.put(
"/security/cves.json",
Expand All @@ -308,8 +320,10 @@ def test_cves_filtered_by_status_and_version(self):

assert add_cves_response.status_code == 200

filtered_cves_response = self.client.get("/security/cves.json?status=needs-triage&version=testrelease2")

filtered_cves_response = self.client.get(
"/security/cves.json?status=needs-triage&version=testrelease2"
)

assert filtered_cves_response.status_code == 200
assert filtered_cves_response.json["total_results"] == 2

Expand Down Expand Up @@ -424,8 +438,9 @@ def test_cve_group_by_functionality(self):

assert initial_cves.status_code == 200
assert initial_cves.json["cves"][0]["priority"] == "critical"

# Add releases because the DB only includes 1 release upon initialization

# Add releases because the DB only includes
# 1 release upon initialization
add_release_response = self.client.post(
"/security/releases.json", json=payloads.release
)
Expand Down
2 changes: 1 addition & 1 deletion webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from flask import make_response, jsonify, request
from flask_apispec import marshal_with, use_kwargs
from sqlalchemy import desc, or_, and_, case, asc
from sqlalchemy import desc, or_, case, asc
from sqlalchemy.exc import DataError, IntegrityError
from sqlalchemy.orm import load_only, selectinload, Query
import dateutil
Expand Down

0 comments on commit 8e67476

Please sign in to comment.