datasecops-cli 0.8.0b1__tar.gz → 0.8.0b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/CHANGELOG.md +10 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/PKG-INFO +5 -1
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/README.md +4 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/pyproject.toml +1 -1
- datasecops_cli-0.8.0b2/src/datasecops_cli/__init__.py +1 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/main.py +7 -42
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/development.py +2 -2
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/linting_service.py +18 -12
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_linting_service.py +68 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_main.py +2 -22
- datasecops_cli-0.8.0b1/src/datasecops_cli/__init__.py +0 -1
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/.github/workflows/auto-tag.yml +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/.github/workflows/publish-cli.yml +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/.github/workflows/test.yml +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/.gitignore +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/AGENTS.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/DEVELOPMENT.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/LICENSE +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/getting-started.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/git-operations.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/legacy.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/legacy_plan_of_action.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/mcp-server.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/docs/squash-merge-into-test-review.md +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/mcp-servers.json +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/setup.ps1 +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/setup.sh +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/config.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/configuration.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/downloads.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/git_operations.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/models/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/models/git_helpers.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/models/project_config.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/bootstrap_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/dbt_project_generator.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/dbt_runner.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/directory_scaffolder.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/download_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/git_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/pipeline_env.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/skill_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/snowflake_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/upstream_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/display.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/file_utils.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/mcp.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/yaml_utils.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_mcp/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_mcp/__main__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_mcp/connection.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_mcp/server.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/__init__.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_config.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_dbt_project_generator_profiles.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_dbt_project_generator_yml.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_dbt_runner.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_directory_scaffolder.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_download_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_file_utils.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_git_operations_menu.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_git_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_mcp_branching_rules.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_mcp_lint_tools.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_models.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_pipeline_env.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_upstream_service.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_version.py +0 -0
- {datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_yaml_utils.py +0 -0
|
@@ -4,6 +4,14 @@ All notable changes to the DataSecOps CLI are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **Linting a specific file by model/object name only looked under `models/`** — `resolve_model_path()`
|
|
10
|
+
(used by the interactive menu's `lint → specific` and `format → specific` options) only globbed
|
|
11
|
+
`models/*.sql`, so a name resolving to a stored procedure, UDF, task, alert, stage, file format or
|
|
12
|
+
DMF under `objects/` couldn't be found. It now searches `models/` first and falls back to `objects/`
|
|
13
|
+
only when nothing matches there, so a model/object basename collision still resolves to the model.
|
|
14
|
+
|
|
7
15
|
### Removed
|
|
8
16
|
|
|
9
17
|
- **All DCM (Database Change Management) support moved to the Meridian CLI** (`pip install meridian-cli`, command
|
|
@@ -11,6 +19,8 @@ All notable changes to the DataSecOps CLI are documented in this file.
|
|
|
11
19
|
the `datasecops dcm ...` and `datasecops model ...` commands, `download dcm`, the DCM menu, bootstrap's DCM
|
|
12
20
|
scaffold, `.datasecops.yml`'s `dcm_*` keys, the `datasecops_model` package, `scripts/vendor_model.py`, `docs/dcm.md`
|
|
13
21
|
and the DCM MCP tools. `datasecops-cli` is dbt only.
|
|
22
|
+
- **CoCo main menu option** — the interactive menu no longer has an option to launch CoCo directly.
|
|
23
|
+
Remaining options are renumbered (`configure` is now `[3]`, `downloads` `[4]`, `bootstrap` `[5]`, `update pkgs` `[6]`).
|
|
14
24
|
|
|
15
25
|
## [0.7.0b17] - 2026-11-05
|
|
16
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: datasecops-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.0b2
|
|
4
4
|
Summary: DataSecOps Framework CLI for Snowflake Native App
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -108,6 +108,10 @@ The Development menu exposes these flags from the underlying `dbt` commands:
|
|
|
108
108
|
These are not available on the SQLFluff (dbt Core 1.x) path; on dbt Core the CLI skips
|
|
109
109
|
`--generate-info-schema`/`--static-analysis strict` with a warning instead of sending a flag
|
|
110
110
|
dbt Core would reject.
|
|
111
|
+
- **`lint` → `specific`** *(both engines)*, **`format` → `specific`** *(dbt2 engine only)* -
|
|
112
|
+
resolve a bare name (e.g. `stg_orders`) by searching `models/` first, then `objects/`
|
|
113
|
+
(stored procedures, UDFs, tasks, alerts, stages, file formats, DMFs) if nothing matched
|
|
114
|
+
under `models/`.
|
|
111
115
|
|
|
112
116
|
## Non-Interactive Mode (CI/CD)
|
|
113
117
|
|
|
@@ -87,6 +87,10 @@ The Development menu exposes these flags from the underlying `dbt` commands:
|
|
|
87
87
|
These are not available on the SQLFluff (dbt Core 1.x) path; on dbt Core the CLI skips
|
|
88
88
|
`--generate-info-schema`/`--static-analysis strict` with a warning instead of sending a flag
|
|
89
89
|
dbt Core would reject.
|
|
90
|
+
- **`lint` → `specific`** *(both engines)*, **`format` → `specific`** *(dbt2 engine only)* -
|
|
91
|
+
resolve a bare name (e.g. `stg_orders`) by searching `models/` first, then `objects/`
|
|
92
|
+
(stored procedures, UDFs, tasks, alerts, stages, file formats, DMFs) if nothing matched
|
|
93
|
+
under `models/`.
|
|
90
94
|
|
|
91
95
|
## Non-Interactive Mode (CI/CD)
|
|
92
96
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.8.0b2"
|
|
@@ -879,40 +879,6 @@ def _main_menu(config: Config, dbt_runner: DbtRunner, git_service: GitService,
|
|
|
879
879
|
git_menu.show()
|
|
880
880
|
|
|
881
881
|
elif option == 3:
|
|
882
|
-
display_action_header("Launch CoCo")
|
|
883
|
-
try:
|
|
884
|
-
import json as _json
|
|
885
|
-
from datasecops_cli.utilities.display import get_input_true_false as _confirm
|
|
886
|
-
conn = config.datasecops.connection_name
|
|
887
|
-
cortex_conn = config.datasecops.cortex_connection or conn
|
|
888
|
-
|
|
889
|
-
# Check current agent connection from CoCo settings
|
|
890
|
-
cortex_settings_path = Path.home() / ".snowflake" / "cortex" / "settings.json"
|
|
891
|
-
if cortex_settings_path.exists():
|
|
892
|
-
settings = _json.loads(cortex_settings_path.read_text(encoding="utf-8"))
|
|
893
|
-
current_agent_conn = settings.get("cortexAgentConnectionName", "")
|
|
894
|
-
if current_agent_conn and current_agent_conn != cortex_conn:
|
|
895
|
-
warning_line(f"CoCo agent connection is '{current_agent_conn}', "
|
|
896
|
-
f"but cortex_connection in .datasecops.yml is '{cortex_conn}'")
|
|
897
|
-
if _confirm(f"Update agent connection to '{cortex_conn}'?", default="y"):
|
|
898
|
-
settings["cortexAgentConnectionName"] = cortex_conn
|
|
899
|
-
cortex_settings_path.write_text(
|
|
900
|
-
_json.dumps(settings, indent=2), encoding="utf-8")
|
|
901
|
-
success_line(f"Agent connection updated to: {cortex_conn}")
|
|
902
|
-
else:
|
|
903
|
-
cortex_conn = current_agent_conn
|
|
904
|
-
info_line(f"Keeping agent connection: {cortex_conn}")
|
|
905
|
-
|
|
906
|
-
# Set SQL connection
|
|
907
|
-
info_line(f"SQL connection: {conn}")
|
|
908
|
-
info_line(f"Agent connection: {cortex_conn}")
|
|
909
|
-
# Launch with --connection to set agent connection
|
|
910
|
-
subprocess.run(["cortex", "--connection", conn])
|
|
911
|
-
except FileNotFoundError:
|
|
912
|
-
error_line("CoCo CLI not found. Install it from: https://docs.snowflake.com/en/user-guide/cortex-code")
|
|
913
|
-
complete_action()
|
|
914
|
-
|
|
915
|
-
elif option == 4:
|
|
916
882
|
config_menu = ConfigurationMenu(
|
|
917
883
|
download_service, linting_service,
|
|
918
884
|
profile_name, config.dbt_project_dir,
|
|
@@ -924,7 +890,7 @@ def _main_menu(config: Config, dbt_runner: DbtRunner, git_service: GitService,
|
|
|
924
890
|
)
|
|
925
891
|
config_menu.show()
|
|
926
892
|
|
|
927
|
-
elif option ==
|
|
893
|
+
elif option == 4:
|
|
928
894
|
dl_menu = DownloadsMenu(
|
|
929
895
|
download_service, skill_service, dbt_runner,
|
|
930
896
|
profile_name, config.dbt_project_dir,
|
|
@@ -936,7 +902,7 @@ def _main_menu(config: Config, dbt_runner: DbtRunner, git_service: GitService,
|
|
|
936
902
|
)
|
|
937
903
|
dl_menu.show()
|
|
938
904
|
|
|
939
|
-
elif option ==
|
|
905
|
+
elif option == 5:
|
|
940
906
|
from datasecops_cli.utilities.display import get_input_true_false, select_multiple_from_list
|
|
941
907
|
platform = config.source_control.source_control_platform.lower()
|
|
942
908
|
info_line(f"Platform: {platform}")
|
|
@@ -961,7 +927,7 @@ def _main_menu(config: Config, dbt_runner: DbtRunner, git_service: GitService,
|
|
|
961
927
|
error_line(f"Bootstrap failed: {e}")
|
|
962
928
|
complete_action()
|
|
963
929
|
|
|
964
|
-
elif option ==
|
|
930
|
+
elif option == 6 and has_outdated:
|
|
965
931
|
_update_upstream_packages(config, dbt_runner, upstream_statuses)
|
|
966
932
|
# Refresh upstream statuses after update
|
|
967
933
|
from datasecops_cli.services.upstream_service import check_upstream_versions
|
|
@@ -986,12 +952,11 @@ def _show_main_menu(profile_name: str, git_service: GitService = None,
|
|
|
986
952
|
upstream_info=upstream_statuses)
|
|
987
953
|
menu_option(1, "development - dbt Development Commands")
|
|
988
954
|
menu_option(2, "git - Source Control Operations")
|
|
989
|
-
menu_option(3, "
|
|
990
|
-
menu_option(4, "
|
|
991
|
-
menu_option(5, "
|
|
992
|
-
menu_option(6, "bootstrap - Set up a new dbt project with all framework config")
|
|
955
|
+
menu_option(3, "configure - Install tools, MCP servers & project setup")
|
|
956
|
+
menu_option(4, "downloads - Download Configs & Skills")
|
|
957
|
+
menu_option(5, "bootstrap - Set up a new dbt project with all framework config")
|
|
993
958
|
if upstream_statuses and any(s.needs_update for s in upstream_statuses):
|
|
994
|
-
menu_option(
|
|
959
|
+
menu_option(6, "update pkgs - Update upstream packages to latest versions")
|
|
995
960
|
menu_option(0, "exit - Exit")
|
|
996
961
|
|
|
997
962
|
|
|
@@ -359,7 +359,7 @@ class DevelopmentMenu:
|
|
|
359
359
|
exclude_rules=exclude_rules,
|
|
360
360
|
jinja_render_mode=jinja_render_mode)
|
|
361
361
|
else:
|
|
362
|
-
error_line(f"Could not find model '{name}' in models/
|
|
362
|
+
error_line(f"Could not find model '{name}' in models/ or objects/")
|
|
363
363
|
elif option == 4:
|
|
364
364
|
if not self.downloads:
|
|
365
365
|
error_line("Download service not available")
|
|
@@ -377,7 +377,7 @@ class DevelopmentMenu:
|
|
|
377
377
|
if name:
|
|
378
378
|
path = name if name.endswith(".sql") else self.linting.resolve_model_path(name)
|
|
379
379
|
if not path:
|
|
380
|
-
error_line(f"Could not find model '{name}' in models/
|
|
380
|
+
error_line(f"Could not find model '{name}' in models/ or objects/")
|
|
381
381
|
complete_action()
|
|
382
382
|
continue
|
|
383
383
|
check = get_input_true_false(
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/linting_service.py
RENAMED
|
@@ -100,18 +100,24 @@ class LintingService:
|
|
|
100
100
|
return self.install_requirements(missing)
|
|
101
101
|
|
|
102
102
|
def resolve_model_path(self, name: str) -> str | None:
|
|
103
|
-
"""Resolve a model name (e.g. 'stg_orders') to its SQL file path
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
"""Resolve a model/object name (e.g. 'stg_orders') to its SQL file path.
|
|
104
|
+
|
|
105
|
+
Searches models/ first, then falls back to objects/ (stored procedures, UDFs,
|
|
106
|
+
tasks, alerts, stages, file formats, DMFs) only if nothing matched under models/,
|
|
107
|
+
so a model name that happens to collide with an object's basename still resolves.
|
|
108
|
+
"""
|
|
109
|
+
for subdir in ("models", "objects"):
|
|
110
|
+
search_dir = self.project_dir / subdir
|
|
111
|
+
if not search_dir.exists():
|
|
112
|
+
continue
|
|
113
|
+
matches = list(search_dir.rglob(f"{name}.sql"))
|
|
114
|
+
if len(matches) == 1:
|
|
115
|
+
return str(matches[0].relative_to(self.project_dir))
|
|
116
|
+
if len(matches) > 1:
|
|
117
|
+
warning_line(f"Multiple matches for '{name}':")
|
|
118
|
+
for m in matches:
|
|
119
|
+
info_line(f" {m.relative_to(self.project_dir)}")
|
|
120
|
+
return None
|
|
115
121
|
return None
|
|
116
122
|
|
|
117
123
|
def lint_file(self, file_path: str = None, fix: bool = False, rules: str = None,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Tests for engine-conditional logic in datasecops_cli.services.linting_service."""
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
from unittest.mock import patch, MagicMock
|
|
3
4
|
|
|
4
5
|
from datasecops_cli.services.linting_service import LintingService
|
|
@@ -155,3 +156,70 @@ class TestEnsureTemplaterInstalled:
|
|
|
155
156
|
result = service.ensure_templater_installed(required_packages=["sqlfluff==3.4.0"])
|
|
156
157
|
assert result is True
|
|
157
158
|
mock_run.assert_not_called()
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class TestResolveModelPath:
|
|
162
|
+
def test_finds_model_under_models(self, tmp_path):
|
|
163
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
164
|
+
staging = tmp_path / "models" / "staging"
|
|
165
|
+
staging.mkdir(parents=True)
|
|
166
|
+
(staging / "stg_orders.sql").write_text("select 1")
|
|
167
|
+
|
|
168
|
+
path = service.resolve_model_path("stg_orders")
|
|
169
|
+
assert path == str(Path("models") / "staging" / "stg_orders.sql")
|
|
170
|
+
|
|
171
|
+
def test_finds_object_under_objects(self, tmp_path):
|
|
172
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
173
|
+
procs = tmp_path / "objects" / "stored_procedures"
|
|
174
|
+
procs.mkdir(parents=True)
|
|
175
|
+
(procs / "sp_refresh.sql").write_text("call sp_refresh()")
|
|
176
|
+
|
|
177
|
+
path = service.resolve_model_path("sp_refresh")
|
|
178
|
+
assert path == str(Path("objects") / "stored_procedures" / "sp_refresh.sql")
|
|
179
|
+
|
|
180
|
+
def test_model_takes_priority_over_object_with_same_basename(self, tmp_path):
|
|
181
|
+
"""A model and an object sharing a basename must still resolve (to the model),
|
|
182
|
+
not be reported as ambiguous."""
|
|
183
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
184
|
+
models_dir = tmp_path / "models"
|
|
185
|
+
models_dir.mkdir()
|
|
186
|
+
(models_dir / "shared.sql").write_text("select 1")
|
|
187
|
+
objects_dir = tmp_path / "objects" / "tasks"
|
|
188
|
+
objects_dir.mkdir(parents=True)
|
|
189
|
+
(objects_dir / "shared.sql").write_text("create task shared ...")
|
|
190
|
+
|
|
191
|
+
path = service.resolve_model_path("shared")
|
|
192
|
+
assert path == str(Path("models") / "shared.sql")
|
|
193
|
+
|
|
194
|
+
def test_returns_none_when_no_match(self, tmp_path):
|
|
195
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
196
|
+
(tmp_path / "models").mkdir()
|
|
197
|
+
(tmp_path / "objects").mkdir()
|
|
198
|
+
|
|
199
|
+
assert service.resolve_model_path("does_not_exist") is None
|
|
200
|
+
|
|
201
|
+
def test_returns_none_when_neither_directory_exists(self, tmp_path):
|
|
202
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
203
|
+
assert service.resolve_model_path("anything") is None
|
|
204
|
+
|
|
205
|
+
def test_ambiguous_match_within_models_returns_none(self, tmp_path):
|
|
206
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
207
|
+
a = tmp_path / "models" / "a"
|
|
208
|
+
b = tmp_path / "models" / "b"
|
|
209
|
+
a.mkdir(parents=True)
|
|
210
|
+
b.mkdir(parents=True)
|
|
211
|
+
(a / "dup.sql").write_text("select 1")
|
|
212
|
+
(b / "dup.sql").write_text("select 2")
|
|
213
|
+
|
|
214
|
+
assert service.resolve_model_path("dup") is None
|
|
215
|
+
|
|
216
|
+
def test_ambiguous_match_within_objects_returns_none(self, tmp_path):
|
|
217
|
+
service = LintingService(tmp_path, dbt_engine="dbt2")
|
|
218
|
+
a = tmp_path / "objects" / "tasks"
|
|
219
|
+
b = tmp_path / "objects" / "alerts"
|
|
220
|
+
a.mkdir(parents=True)
|
|
221
|
+
b.mkdir(parents=True)
|
|
222
|
+
(a / "dup.sql").write_text("create task dup ...")
|
|
223
|
+
(b / "dup.sql").write_text("create alert dup ...")
|
|
224
|
+
|
|
225
|
+
assert service.resolve_model_path("dup") is None
|
|
@@ -405,7 +405,7 @@ class TestConnectAndLoad:
|
|
|
405
405
|
|
|
406
406
|
|
|
407
407
|
class TestMainMenuBootstrapOption:
|
|
408
|
-
"""Regression tests for option [
|
|
408
|
+
"""Regression tests for option [5] bootstrap in the interactive main menu."""
|
|
409
409
|
|
|
410
410
|
def _make_config(self):
|
|
411
411
|
config = Config()
|
|
@@ -419,7 +419,7 @@ class TestMainMenuBootstrapOption:
|
|
|
419
419
|
config = self._make_config()
|
|
420
420
|
|
|
421
421
|
monkeypatch.setattr("datasecops_cli.utilities.display.get_input_true_false", lambda *a, **k: False)
|
|
422
|
-
with patch("datasecops_cli.main.get_input_number", side_effect=[
|
|
422
|
+
with patch("datasecops_cli.main.get_input_number", side_effect=[5, 0]), \
|
|
423
423
|
patch("datasecops_cli.main.BootstrapService") as MockBootstrap, \
|
|
424
424
|
patch("datasecops_cli.main._show_main_menu"), \
|
|
425
425
|
patch("datasecops_cli.main.error_line") as mock_error, \
|
|
@@ -433,26 +433,6 @@ class TestMainMenuBootstrapOption:
|
|
|
433
433
|
assert "boom" in mock_error.call_args.args[0]
|
|
434
434
|
mock_complete.assert_called_once()
|
|
435
435
|
|
|
436
|
-
def test_coco_then_bootstrap_does_not_crash(self, tmp_path, monkeypatch):
|
|
437
|
-
"""Launching CoCo (option 3, missing executable) before bootstrap (option 6) must
|
|
438
|
-
not raise UnboundLocalError from a branch-local import shadowing complete_action."""
|
|
439
|
-
config = self._make_config()
|
|
440
|
-
|
|
441
|
-
monkeypatch.setattr("datasecops_cli.utilities.display.get_input_true_false", lambda *a, **k: False)
|
|
442
|
-
with patch("datasecops_cli.main.get_input_number", side_effect=[3, 6, 0]), \
|
|
443
|
-
patch("datasecops_cli.main.subprocess.run", side_effect=FileNotFoundError), \
|
|
444
|
-
patch("datasecops_cli.main.Path.home", return_value=tmp_path), \
|
|
445
|
-
patch("datasecops_cli.main.BootstrapService") as MockBootstrap, \
|
|
446
|
-
patch("datasecops_cli.main._show_main_menu"), \
|
|
447
|
-
patch("datasecops_cli.main.complete_action") as mock_complete:
|
|
448
|
-
MockBootstrap.return_value.run.return_value = True
|
|
449
|
-
|
|
450
|
-
_main_menu(config, MagicMock(), None, MagicMock(), MagicMock(),
|
|
451
|
-
MagicMock(), MagicMock())
|
|
452
|
-
|
|
453
|
-
# Once for the missing-CoCo message, once after bootstrap
|
|
454
|
-
assert mock_complete.call_count == 2
|
|
455
|
-
|
|
456
436
|
|
|
457
437
|
class TestDownloadPackageFiltering:
|
|
458
438
|
"""Tests for dbt package filtering by profile."""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.0b1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/menus/git_operations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/models/project_config.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/bootstrap_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/download_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/git_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/pipeline_env.py
RENAMED
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/skill_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/snowflake_service.py
RENAMED
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/services/upstream_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/file_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/src/datasecops_cli/utilities/yaml_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{datasecops_cli-0.8.0b1 → datasecops_cli-0.8.0b2}/tests/test_dbt_project_generator_profiles.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|