Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
Co-authored-by: jonathan-d-zhang <[email protected]>
Signed-off-by: Bruno Rodrigues dos Santos <[email protected]>
  • Loading branch information
BruDriguezz and jonathan-d-zhang committed Aug 15, 2024
1 parent f7dc375 commit 05f537e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/mainframe/endpoints/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def lookup_package_info(
query = query.where(Scan.finished_at >= dt.datetime.fromtimestamp(since, tz=dt.timezone.utc))

with session, session.begin():
log.info("Package info queried")
params = Params(page=page, size=size)
return paginate(
session, query, params=params, transformer=lambda items: [Package.from_db(item) for item in items]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ def test_package_lookup(
test_data: list[Scan],
db_session: Session,
):
expected_scans = [
expected_scans = {
(scan.name, scan.version)
for scan in test_data
if (since is None or (scan.finished_at is not None and since <= int(scan.finished_at.timestamp())))
and (name is None or scan.name == name)
and (version is None or scan.version == version)
]
}

actual_scans = lookup_package_info(db_session, since, name, version, page, size)
assert set(expected_scans) == {(scan.name, scan.version) for scan in actual_scans.items}
assert expected_scans == {(scan.name, scan.version) for scan in actual_scans.items}


@pytest.mark.parametrize(
Expand Down

0 comments on commit 05f537e

Please sign in to comment.