-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_cli.py
More file actions
115 lines (91 loc) · 3.6 KB
/
test_cli.py
File metadata and controls
115 lines (91 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# test_app.py
from click.testing import CliRunner
from datapilot.cli.main import datapilot
def test_project_health_with_required_and_optional_args():
runner = CliRunner()
manifest_path = "tests/data/manifest_v11.json"
catalog_path = "tests/data/catalog_v1.json"
config_path = "tests/data/config.yml"
# Simulate command invocation
result = runner.invoke(
datapilot, ["dbt", "project-health", "--manifest-path", manifest_path, "--catalog-path", catalog_path, "--config-path", config_path]
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Add more assertions here to validate the behavior of your command,
# for example, checking that the output contains expected text.
assert "-----------" in result.output
def test_project_health_with_only_required_arg():
runner = CliRunner()
manifest_path = "tests/data/manifest_v11.json"
# Simulate command invocation without optional arguments
result = runner.invoke(
datapilot,
[
"dbt",
"project-health",
"--manifest-path",
manifest_path,
],
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Validate behavior for when only the required argument is provided
assert "-----------" in result.output
def test_project_health_with_only_required_arg_version1_6():
runner = CliRunner()
manifest_path = "tests/data/manifest_v10.json"
# Simulate command invocation without optional arguments
result = runner.invoke(
datapilot,
[
"dbt",
"project-health",
"--manifest-path",
manifest_path,
],
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Validate behavior for when only the required argument is provided
assert "-----------" in result.output
def test_project_health_with_macro_args():
runner = CliRunner()
manifest_path = "tests/data/manifest_v10macroargs.json"
# Simulate command invocation without optional arguments
result = runner.invoke(
datapilot,
[
"dbt",
"project-health",
"--manifest-path",
manifest_path,
],
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Validate behavior for when only the required argument is provided
assert "-----------" in result.output
manifest_path = "tests/data/manifest_v11macroargs.json"
# Simulate command invocation without optional arguments
result = runner.invoke(
datapilot,
[
"dbt",
"project-health",
"--manifest-path",
manifest_path,
],
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Validate behavior for when only the required argument is provided
assert "-----------" in result.output
def test_project_health_with_required_and_optional_args_v12():
runner = CliRunner()
manifest_path = "tests/data/manifest_v12.json"
catalog_path = "tests/data/catalog_v12.json"
config_path = "tests/data/config.yml"
# Simulate command invocation
result = runner.invoke(
datapilot, ["dbt", "project-health", "--manifest-path", manifest_path, "--catalog-path", catalog_path, "--config-path", config_path]
)
assert result.exit_code == 0 # Ensure the command executed successfully
# Add more assertions here to validate the behavior of your command,
# for example, checking that the output contains expected text.
assert "-----------" in result.output