Skip to content

Commit

Permalink
add github snapshot tests (#346)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman authored Oct 18, 2023
1 parent 0dd478a commit 2349606
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/github-security-advisory/schema-1.0.1.json","identifier":"github:java/ghsa-mh6f-8j2x-4483","item":{"Vulnerability":{},"Advisory":{"Classification":"GENERAL","Severity":"Critical","CVSS":{"version":"3.1","vector_string":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","base_metrics":{"base_score":9.8,"exploitability_score":3.9,"impact_score":5.9,"base_severity":"Critical"},"status":"N/A"},"FixedIn":[{"name":"org.webjars.npm:jquery","identifier":"1.9.0","ecosystem":"java","namespace":"github:java","range":">= 1.7.1 <= 1.8.3"}],"Summary":"Critical severity vulnerability that affects flatmap-stream and event-stream","url":"https://github.com/advisories/GHSA-mh6f-8j2x-4483","CVE":[],"Metadata":{"CVE":[]},"ghsaId":"GHSA-mh6f-8j2x-4483","published":"2018-11-26T23:58:21Z","updated":"2023-01-12T05:08:40Z","withdrawn":null,"namespace":"github:java"}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/github-security-advisory/schema-1.0.1.json","identifier":"github:npm/ghsa-mh6f-8j2x-4483","item":{"Vulnerability":{},"Advisory":{"Classification":"GENERAL","Severity":"Critical","CVSS":{"version":"3.1","vector_string":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","base_metrics":{"base_score":9.8,"exploitability_score":3.9,"impact_score":5.9,"base_severity":"Critical"},"status":"N/A"},"FixedIn":[{"name":"flatmap-stream","identifier":"None","ecosystem":"npm","namespace":"github:npm","range":""},{"name":"event-stream","identifier":"4.0.0","ecosystem":"npm","namespace":"github:npm","range":""}],"Summary":"Critical severity vulnerability that affects flatmap-stream and event-stream","url":"https://github.com/advisories/GHSA-mh6f-8j2x-4483","CVE":[],"Metadata":{"CVE":[]},"ghsaId":"GHSA-mh6f-8j2x-4483","published":"2018-11-26T23:58:21Z","updated":"2023-01-12T05:08:40Z","withdrawn":null,"namespace":"github:npm"}}}
12 changes: 12 additions & 0 deletions tests/unit/providers/github/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,15 @@ def test_provider_schema(helpers, fake_get_query, advisories):
provider.update(None)

assert workspace.result_schemas_valid(require_entries=True)


def test_provider_via_snapshot(helpers, fake_get_query, advisories):
fake_get_query([advisories(), advisories(has_next_page=True)])
workspace = helpers.provider_workspace_helper(name=Provider.name())

c = Config(token="secret", api_url="https://localhost")
c.runtime.result_store = result.StoreStrategy.FLAT_FILE
provider = Provider(root=workspace.root, config=c)
provider.update(None)

workspace.assert_result_snapshots()

0 comments on commit 2349606

Please sign in to comment.