|
1
|
"""Tests for the CLI commands (help text, version, option presence).""" |
|
2
|
|
|
3
|
from click.testing import CliRunner |
|
4
|
|
|
5
|
from video_processor.cli.commands import cli |
|
6
|
|
|
7
|
|
|
8
|
class TestCLIRoot: |
|
9
|
def test_version(self): |
|
10
|
runner = CliRunner() |
|
11
|
result = runner.invoke(cli, ["--version"]) |
|
12
|
assert result.exit_code == 0 |
|
13
|
assert "PlanOpticon" in result.output |
|
14
|
assert "0.5.0" in result.output # matches @click.version_option |
|
15
|
|
|
16
|
def test_help(self): |
|
17
|
runner = CliRunner() |
|
18
|
result = runner.invoke(cli, ["--help"]) |
|
19
|
assert result.exit_code == 0 |
|
20
|
assert "PlanOpticon" in result.output |
|
21
|
assert "analyze" in result.output |
|
22
|
assert "query" in result.output |
|
23
|
assert "agent" in result.output |
|
24
|
assert "kg" in result.output |
|
25
|
assert "gws" in result.output |
|
26
|
assert "m365" in result.output |
|
27
|
assert "recordings" in result.output |
|
28
|
assert "ingest" in result.output |
|
29
|
assert "batch" in result.output |
|
30
|
assert "--chat" in result.output |
|
31
|
assert "--interactive" in result.output |
|
32
|
assert "companion" in result.output |
|
33
|
|
|
34
|
|
|
35
|
class TestAnalyzeHelp: |
|
36
|
def test_help(self): |
|
37
|
runner = CliRunner() |
|
38
|
result = runner.invoke(cli, ["analyze", "--help"]) |
|
39
|
assert result.exit_code == 0 |
|
40
|
assert "--input" in result.output or "-i" in result.output |
|
41
|
assert "--output" in result.output or "-o" in result.output |
|
42
|
assert "--depth" in result.output |
|
43
|
assert "--provider" in result.output |
|
44
|
assert "--output-format" in result.output |
|
45
|
assert "--templates-dir" in result.output |
|
46
|
assert "--speakers" in result.output |
|
47
|
assert "--vision-model" in result.output |
|
48
|
assert "--chat-model" in result.output |
|
49
|
assert "--sampling-rate" in result.output |
|
50
|
assert "--change-threshold" in result.output |
|
51
|
assert "--periodic-capture" in result.output |
|
52
|
|
|
53
|
|
|
54
|
class TestQueryHelp: |
|
55
|
def test_help(self): |
|
56
|
runner = CliRunner() |
|
57
|
result = runner.invoke(cli, ["query", "--help"]) |
|
58
|
assert result.exit_code == 0 |
|
59
|
assert "--db-path" in result.output |
|
60
|
assert "--mode" in result.output |
|
61
|
assert "--format" in result.output |
|
62
|
assert "--interactive" in result.output or "-I" in result.output |
|
63
|
assert "--provider" in result.output |
|
64
|
assert "--chat-model" in result.output |
|
65
|
assert "QUESTION" in result.output |
|
66
|
|
|
67
|
|
|
68
|
class TestAgentHelp: |
|
69
|
def test_help(self): |
|
70
|
runner = CliRunner() |
|
71
|
result = runner.invoke(cli, ["agent", "--help"]) |
|
72
|
assert result.exit_code == 0 |
|
73
|
assert "--kb" in result.output |
|
74
|
assert "--interactive" in result.output or "-I" in result.output |
|
75
|
assert "--export" in result.output |
|
76
|
assert "--provider" in result.output |
|
77
|
assert "--chat-model" in result.output |
|
78
|
assert "REQUEST" in result.output |
|
79
|
|
|
80
|
|
|
81
|
class TestKGHelp: |
|
82
|
def test_help(self): |
|
83
|
runner = CliRunner() |
|
84
|
result = runner.invoke(cli, ["kg", "--help"]) |
|
85
|
assert result.exit_code == 0 |
|
86
|
assert "convert" in result.output |
|
87
|
assert "Knowledge graph" in result.output |
|
88
|
|
|
89
|
def test_convert_help(self): |
|
90
|
runner = CliRunner() |
|
91
|
result = runner.invoke(cli, ["kg", "convert", "--help"]) |
|
92
|
assert result.exit_code == 0 |
|
93
|
assert "SOURCE_PATH" in result.output |
|
94
|
assert "DEST_PATH" in result.output |
|
95
|
|
|
96
|
|
|
97
|
class TestIngestHelp: |
|
98
|
def test_help(self): |
|
99
|
runner = CliRunner() |
|
100
|
result = runner.invoke(cli, ["ingest", "--help"]) |
|
101
|
assert result.exit_code == 0 |
|
102
|
assert "INPUT_PATH" in result.output |
|
103
|
assert "--output" in result.output or "-o" in result.output |
|
104
|
assert "--db-path" in result.output |
|
105
|
assert "--recursive" in result.output |
|
106
|
assert "--provider" in result.output |
|
107
|
assert "--chat-model" in result.output |
|
108
|
|
|
109
|
|
|
110
|
class TestBatchHelp: |
|
111
|
def test_help(self): |
|
112
|
runner = CliRunner() |
|
113
|
result = runner.invoke(cli, ["batch", "--help"]) |
|
114
|
assert result.exit_code == 0 |
|
115
|
assert "--input-dir" in result.output or "-i" in result.output |
|
116
|
assert "--output" in result.output or "-o" in result.output |
|
117
|
assert "--depth" in result.output |
|
118
|
assert "--pattern" in result.output |
|
119
|
assert "--source" in result.output |
|
120
|
assert "--folder-id" in result.output |
|
121
|
|
|
122
|
|
|
123
|
class TestAgentAnalyzeHelp: |
|
124
|
def test_help(self): |
|
125
|
runner = CliRunner() |
|
126
|
result = runner.invoke(cli, ["agent-analyze", "--help"]) |
|
127
|
assert result.exit_code == 0 |
|
128
|
assert "--input" in result.output or "-i" in result.output |
|
129
|
assert "--output" in result.output or "-o" in result.output |
|
130
|
assert "--depth" in result.output |
|
131
|
assert "--provider" in result.output |
|
132
|
|
|
133
|
|
|
134
|
class TestListModelsHelp: |
|
135
|
def test_help(self): |
|
136
|
runner = CliRunner() |
|
137
|
result = runner.invoke(cli, ["list-models", "--help"]) |
|
138
|
assert result.exit_code == 0 |
|
139
|
assert "Discover" in result.output or "models" in result.output |
|
140
|
|
|
141
|
|
|
142
|
class TestClearCacheHelp: |
|
143
|
def test_help(self): |
|
144
|
runner = CliRunner() |
|
145
|
result = runner.invoke(cli, ["clear-cache", "--help"]) |
|
146
|
assert result.exit_code == 0 |
|
147
|
assert "--cache-dir" in result.output |
|
148
|
assert "--older-than" in result.output |
|
149
|
assert "--all" in result.output |
|
150
|
|
|
151
|
|
|
152
|
class TestGWSHelp: |
|
153
|
def test_help(self): |
|
154
|
runner = CliRunner() |
|
155
|
result = runner.invoke(cli, ["gws", "--help"]) |
|
156
|
assert result.exit_code == 0 |
|
157
|
assert "list" in result.output |
|
158
|
assert "fetch" in result.output |
|
159
|
assert "ingest" in result.output |
|
160
|
|
|
161
|
def test_list_help(self): |
|
162
|
runner = CliRunner() |
|
163
|
result = runner.invoke(cli, ["gws", "list", "--help"]) |
|
164
|
assert result.exit_code == 0 |
|
165
|
assert "--folder-id" in result.output |
|
166
|
assert "--query" in result.output |
|
167
|
|
|
168
|
def test_ingest_help(self): |
|
169
|
runner = CliRunner() |
|
170
|
result = runner.invoke(cli, ["gws", "ingest", "--help"]) |
|
171
|
assert result.exit_code == 0 |
|
172
|
assert "--folder-id" in result.output |
|
173
|
assert "--doc-id" in result.output |
|
174
|
assert "--db-path" in result.output |
|
175
|
|
|
176
|
|
|
177
|
class TestM365Help: |
|
178
|
def test_help(self): |
|
179
|
runner = CliRunner() |
|
180
|
result = runner.invoke(cli, ["m365", "--help"]) |
|
181
|
assert result.exit_code == 0 |
|
182
|
assert "list" in result.output |
|
183
|
assert "fetch" in result.output |
|
184
|
assert "ingest" in result.output |
|
185
|
|
|
186
|
def test_list_help(self): |
|
187
|
runner = CliRunner() |
|
188
|
result = runner.invoke(cli, ["m365", "list", "--help"]) |
|
189
|
assert result.exit_code == 0 |
|
190
|
assert "--web-url" in result.output |
|
191
|
assert "--folder-url" in result.output |
|
192
|
assert "--recursive" in result.output |
|
193
|
|
|
194
|
def test_ingest_help(self): |
|
195
|
runner = CliRunner() |
|
196
|
result = runner.invoke(cli, ["m365", "ingest", "--help"]) |
|
197
|
assert result.exit_code == 0 |
|
198
|
assert "--web-url" in result.output |
|
199
|
assert "--file-id" in result.output |
|
200
|
assert "--db-path" in result.output |
|
201
|
|
|
202
|
|
|
203
|
class TestRecordingsHelp: |
|
204
|
def test_group_help(self): |
|
205
|
runner = CliRunner() |
|
206
|
result = runner.invoke(cli, ["recordings", "--help"]) |
|
207
|
assert result.exit_code == 0 |
|
208
|
assert "zoom-list" in result.output |
|
209
|
assert "teams-list" in result.output |
|
210
|
assert "meet-list" in result.output |
|
211
|
|
|
212
|
def test_zoom_list_help(self): |
|
213
|
runner = CliRunner() |
|
214
|
result = runner.invoke(cli, ["recordings", "zoom-list", "--help"]) |
|
215
|
assert result.exit_code == 0 |
|
216
|
assert "ZOOM_CLIENT_ID" in result.output |
|
217
|
|
|
218
|
def test_teams_list_help(self): |
|
219
|
runner = CliRunner() |
|
220
|
result = runner.invoke(cli, ["recordings", "teams-list", "--help"]) |
|
221
|
assert result.exit_code == 0 |
|
222
|
assert "--user-id" in result.output |
|
223
|
|
|
224
|
def test_meet_list_help(self): |
|
225
|
runner = CliRunner() |
|
226
|
result = runner.invoke(cli, ["recordings", "meet-list", "--help"]) |
|
227
|
assert result.exit_code == 0 |
|
228
|
assert "--folder-id" in result.output |
|
229
|
|
|
230
|
|
|
231
|
class TestAuthHelp: |
|
232
|
def test_help(self): |
|
233
|
runner = CliRunner() |
|
234
|
result = runner.invoke(cli, ["auth", "--help"]) |
|
235
|
assert result.exit_code == 0 |
|
236
|
assert "google" in result.output |
|
237
|
assert "dropbox" in result.output |
|
238
|
assert "zoom" in result.output |
|
239
|
assert "notion" in result.output |
|
240
|
assert "github" in result.output |
|
241
|
assert "microsoft" in result.output |
|
242
|
assert "--logout" in result.output |
|
243
|
|
|
244
|
|
|
245
|
class TestCompanionHelp: |
|
246
|
def test_help(self): |
|
247
|
runner = CliRunner() |
|
248
|
result = runner.invoke(cli, ["companion", "--help"]) |
|
249
|
assert result.exit_code == 0 |
|
250
|
assert "--kb" in result.output |
|
251
|
assert "--provider" in result.output |
|
252
|
assert "--chat-model" in result.output |
|
253
|
|