Skip to content

Commit 6c78137

Browse files
author
Neil
committed
Move misplaced test functions to test/test_source_osv.py
1 parent 3715e7e commit 6c78137

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/test_osv_source.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,20 @@ async def test_update_ecosystems_mocked():
1717

1818
await osv.update_ecosystems()
1919

20-
assert osv.ecosystems == ["ecosystem1"]
20+
assert osv.ecosystems == ["ecosystem1"]
21+
22+
@pytest.mark.asyncio
23+
@patch("cve_bin_tool.data_sources.osv_source.aio_run_command", new_callable=AsyncMock)
24+
async def test_update_ecosystems(mock_aio_run_command):
25+
# Mock gsutil output: two folders, one of them contains all.zip
26+
mock_aio_run_command.side_effect = [
27+
b"https://osv-vulnerabilities/python/\nhttps://osv-vulnerabilities/rust/\n",
28+
b"https://osv-vulnerabilities/python/all.zip\n",
29+
b"", # rust does not contain all.zip
30+
]
31+
32+
osv = OSV_Source()
33+
await osv.update_ecosystems()
34+
35+
assert "python" in osv.ecosystems
36+
assert "rust" not in osv.ecosystems

0 commit comments

Comments
 (0)