Skip to content

Commit ebacb9f

Browse files
Add tests for leading d2d configurations
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent d6403f1 commit ebacb9f

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

scanpipe/pipes/d2d_config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ def load_ecosystem_config(pipeline, options):
154154
# Add default configurations which are common accross ecosystems
155155
pipeline.ecosystem_config = ECOSYSTEM_CONFIGS.get("Default")
156156

157-
if not options:
158-
return
159-
160157
# Add configurations for each selected ecosystem
161158
for selected_option in options:
162159
if selected_option not in ECOSYSTEM_CONFIGS:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"ecosystem_option": "Default",
3+
"matchable_package_extensions": [".jar", ".war", ".gem", ".zip", ".tar.gz", ".tar.xz"],
4+
"matchable_resource_extensions": [".map", ".js", ".mjs", ".ts", ".d.ts", ".jsx", ".tsx", ".css", ".scss", ".less", ".sass", ".soy",".class", ".rb"],
5+
"doc_extensions": [".pdf", ".doc", ".docx", ".ppt", ".pptx", ".tex", ".odt", ".odp"],
6+
"deployed_resource_path_exclusions": ["*checksums.yaml.gz*", "*metadata.gz*"],
7+
"devel_resource_path_exclusions": ["*/tests/*"],
8+
"standard_symbols_to_exclude": [],
9+
"source_symbol_extensions": []
10+
}

scanpipe/tests/pipes/test_d2d.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
# Visit https://github.com/nexB/scancode.io for support and download.
2222

2323
import io
24+
import json
2425
import sys
2526
import tempfile
2627
import uuid
28+
from dataclasses import asdict
2729
from pathlib import Path
2830
from unittest import mock
2931
from unittest import skipIf
@@ -1864,3 +1866,21 @@ def test_scanpipe_pipes_d2d_map_javascript_strings(self):
18641866
map_type="javascript_strings",
18651867
).count(),
18661868
)
1869+
1870+
def test_scanpipe_d2d_load_ecosystem_config(self):
1871+
pipeline_name = "map_deploy_to_develop"
1872+
selected_groups = ["Ruby", "Java", "JavaScript"]
1873+
1874+
run = self.project1.add_pipeline(
1875+
pipeline_name=pipeline_name, selected_groups=selected_groups
1876+
)
1877+
pipeline = run.make_pipeline_instance()
1878+
d2d_config.load_ecosystem_config(pipeline=pipeline, options=selected_groups)
1879+
1880+
expected_ecosystem_config = (
1881+
self.data / "d2d" / "config" / "ecosystem_config.json"
1882+
)
1883+
with open(expected_ecosystem_config) as f:
1884+
expected_extra_data = json.load(f)
1885+
1886+
self.assertEqual(expected_extra_data, asdict(pipeline.ecosystem_config))

0 commit comments

Comments
 (0)