Skip to content

Commit

Permalink
Remove duplicate test_cpe_matches_request_results, sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier committed Dec 13, 2024
1 parent 49754ba commit d742cdc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
48 changes: 0 additions & 48 deletions tests/nvd/cpe_match/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,54 +341,6 @@ async def test_cpe_matches_match_string_search(self):
with self.assertRaises(StopAsyncIteration):
cpe_match = await anext(it)

async def test_cpe_matches_match_string_search(self):
match_criteria_id = uuid4()
cpe_name_id = uuid4()

self.http_client.get.side_effect = create_cpe_match_responses(
match_criteria_id, cpe_name_id
)

it = aiter(
self.api.cpe_matches(
match_string_search="cpe:2.3:a:sun:jre:*:*:*:*:*:*:*:*"
)
)
cpe_match = await anext(it)

self.assertEqual(
uuid_replace(match_criteria_id, 1, 1), cpe_match.match_criteria_id
)
self.http_client.get.assert_awaited_once_with(
"https://services.nvd.nist.gov/rest/json/cpematch/2.0",
headers={},
params={
"startIndex": 0,
"matchStringSearch": "cpe:2.3:a:sun:jre:*:*:*:*:*:*:*:*",
"resultsPerPage": MAX_CPE_MATCHES_PER_PAGE,
},
)

self.http_client.get.reset_mock()

cpe_match = await anext(it)

self.assertEqual(
uuid_replace(match_criteria_id, 2, 1), cpe_match.match_criteria_id
)
self.http_client.get.assert_awaited_once_with(
"https://services.nvd.nist.gov/rest/json/cpematch/2.0",
headers={},
params={
"startIndex": 1,
"matchStringSearch": "cpe:2.3:a:sun:jre:*:*:*:*:*:*:*:*",
"resultsPerPage": 1,
},
)

with self.assertRaises(StopAsyncIteration):
cpe_match = await anext(it)

async def test_cpe_matches_request_results(self):
match_criteria_id = uuid4()
cpe_name_id = uuid4()
Expand Down
2 changes: 1 addition & 1 deletion tests/nvd/models/test_cpe_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import datetime, timezone
from uuid import UUID

from pontos.nvd.models.cpe_match_string import CPEMatchString, CPEMatch
from pontos.nvd.models.cpe_match_string import CPEMatch, CPEMatchString
from tests.nvd import get_cpe_match_data


Expand Down

0 comments on commit d742cdc

Please sign in to comment.