Skip to content

Commit

Permalink
feat: include record source in machine readable record feedback Datas… (
Browse files Browse the repository at this point in the history
#2891)

…tore model

This commit extends #2582 to include the source of a record. This is so
it's possible to search for all records from a specific source.

Part of #2189
  • Loading branch information
andrewpollock authored Nov 25, 2024
1 parent 60b4ec8 commit eed6788
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docker/importer/importer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ def test_add_finding(self):
"""Test that creating an import finding works."""
expected = osv.ImportFinding(
bug_id='CVE-2024-1234',
source='cve-osv',
findings=[
osv.ImportFindings.INVALID_VERSION,
],
Expand All @@ -1124,9 +1125,8 @@ def test_add_finding(self):
)
expected.put()

for actual in osv.ImportFinding.query(
osv.ImportFinding.bug_id == expected.bug_id):
self.assertEqual(expected, actual)
actual = osv.ImportFinding.get_by_id(expected.bug_id)
self.assertEqual(expected, actual)


if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions osv/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,7 @@ class ImportFindings(enum.IntEnum):
class ImportFinding(ndb.Model):
"""Quality findings about an individual record."""
bug_id: str = ndb.StringProperty()
source: str = ndb.StringProperty()
findings: list[ImportFindings] = ndb.IntegerProperty(repeated=True)
first_seen: datetime = ndb.DateTimeProperty()
last_attempt: datetime = ndb.DateTimeProperty()
Expand Down

0 comments on commit eed6788

Please sign in to comment.