raps 3.8.0

🌼 RAPS (rapeseed) — Rust Autodesk Platform Services CLI
Documentation
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
//! Integration tests for RAPS CLI
//!
//! These tests verify end-to-end functionality and CLI behavior.
//! Most tests are marked with #[ignore] and should be run explicitly with:
//! `cargo test -- --ignored`
//!
//! Note: Integration tests that require actual API access should be run manually
//! with proper credentials configured.

use std::process::Command;

// ============== BASIC CLI TESTS ==============

/// Test that the CLI binary can be executed and shows help
#[test]
#[ignore] // Requires binary to be built
fn test_cli_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "CLI should show help successfully");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("raps"), "Help should contain 'raps'");
    assert!(
        stdout.contains("Command-line interface"),
        "Help should contain description"
    );
}

/// Test that the CLI shows version information
#[test]
#[ignore] // Requires binary to be built
fn test_cli_version() {
    let output = Command::new("cargo")
        .args(["run", "--", "--version"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "CLI should show version successfully"
    );
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("raps"),
        "Version output should contain 'raps'"
    );
    assert!(
        stdout.contains("1.0.0"),
        "Version output should contain version number"
    );
}

/// Test that invalid commands show appropriate error messages
#[test]
#[ignore] // Requires binary to be built
fn test_cli_invalid_command() {
    let output = Command::new("cargo")
        .args(["run", "--", "invalid-command"])
        .output()
        .expect("Failed to execute command");

    assert!(!output.status.success(), "Invalid command should fail");
    let stderr = String::from_utf8_lossy(&output.stderr);
    assert!(
        stderr.contains("error") || stderr.contains("Invalid"),
        "Error output should indicate failure"
    );
}

// ============== EXIT CODE TESTS ==============

/// Test that invalid arguments return exit code 2
#[test]
#[ignore]
fn test_exit_code_invalid_args() {
    let output = Command::new("cargo")
        .args(["run", "--", "bucket", "create"])
        .output()
        .expect("Failed to execute command");

    // Missing required arguments should return exit code 2
    assert_eq!(
        output.status.code(),
        Some(2),
        "Invalid arguments should return exit code 2"
    );
}

// ============== OUTPUT FORMAT TESTS ==============

/// Test JSON output format flag
#[test]
#[ignore]
fn test_output_format_json() {
    let output = Command::new("cargo")
        .args(["run", "--", "--output", "json", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "JSON output flag should be accepted"
    );
}

/// Test YAML output format flag
#[test]
#[ignore]
fn test_output_format_yaml() {
    let output = Command::new("cargo")
        .args(["run", "--", "--output", "yaml", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "YAML output flag should be accepted"
    );
}

/// Test table output format flag
#[test]
#[ignore]
fn test_output_format_table() {
    let output = Command::new("cargo")
        .args(["run", "--", "--output", "table", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "Table output flag should be accepted"
    );
}

// ============== GLOBAL FLAGS TESTS ==============

/// Test --no-color flag
#[test]
#[ignore]
fn test_no_color_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--no-color", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "--no-color flag should be accepted"
    );
}

/// Test --quiet flag
#[test]
#[ignore]
fn test_quiet_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--quiet", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "--quiet flag should be accepted");
}

/// Test --verbose flag
#[test]
#[ignore]
fn test_verbose_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--verbose", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "--verbose flag should be accepted");
}

/// Test --debug flag
#[test]
#[ignore]
fn test_debug_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--debug", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "--debug flag should be accepted");
}

/// Test --non-interactive flag
#[test]
#[ignore]
fn test_non_interactive_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--non-interactive", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "--non-interactive flag should be accepted"
    );
}

/// Test --timeout flag
#[test]
#[ignore]
fn test_timeout_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--timeout", "60", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "--timeout flag should be accepted");
}

/// Test --concurrency flag
#[test]
#[ignore]
fn test_concurrency_flag() {
    let output = Command::new("cargo")
        .args(["run", "--", "--concurrency", "10", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "--concurrency flag should be accepted"
    );
}

// ============== SUBCOMMAND HELP TESTS ==============

/// Test auth subcommand help
#[test]
#[ignore]
fn test_auth_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "auth", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "auth --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("login"), "auth help should mention login");
    assert!(stdout.contains("logout"), "auth help should mention logout");
}

/// Test bucket subcommand help
#[test]
#[ignore]
fn test_bucket_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "bucket", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "bucket --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("list"), "bucket help should mention list");
    assert!(
        stdout.contains("create"),
        "bucket help should mention create"
    );
}

/// Test object subcommand help
#[test]
#[ignore]
fn test_object_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "object", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "object --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("upload"),
        "object help should mention upload"
    );
    assert!(
        stdout.contains("download"),
        "object help should mention download"
    );
}

/// Test translate subcommand help
#[test]
#[ignore]
fn test_translate_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "translate", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "translate --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("start"),
        "translate help should mention start"
    );
    assert!(
        stdout.contains("status"),
        "translate help should mention status"
    );
}

/// Test rfi subcommand help
#[test]
#[ignore]
fn test_rfi_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "rfi", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "rfi --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("list"), "rfi help should mention list");
    assert!(stdout.contains("create"), "rfi help should mention create");
}

/// Test acc subcommand help
#[test]
#[ignore]
fn test_acc_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "acc", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "acc --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("asset"), "acc help should mention asset");
    assert!(
        stdout.contains("submittal"),
        "acc help should mention submittal"
    );
    assert!(
        stdout.contains("checklist"),
        "acc help should mention checklist"
    );
}

/// Test plugin subcommand help
#[test]
#[ignore]
fn test_plugin_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "plugin", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "plugin --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("list"), "plugin help should mention list");
    assert!(
        stdout.contains("enable"),
        "plugin help should mention enable"
    );
    assert!(
        stdout.contains("disable"),
        "plugin help should mention disable"
    );
}

/// Test config subcommand help
#[test]
#[ignore]
fn test_config_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "config", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "config --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("profile"),
        "config help should mention profile"
    );
}

/// Test pipeline subcommand help
#[test]
#[ignore]
fn test_pipeline_help() {
    let output = Command::new("cargo")
        .args(["run", "--", "pipeline", "--help"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "pipeline --help should succeed");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(stdout.contains("run"), "pipeline help should mention run");
    assert!(
        stdout.contains("validate"),
        "pipeline help should mention validate"
    );
}

// ============== SHELL COMPLETION TESTS ==============

/// Test bash completions generation
#[test]
#[ignore]
fn test_completions_bash() {
    let output = Command::new("cargo")
        .args(["run", "--", "completions", "bash"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "bash completions should generate");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("_raps") || stdout.contains("complete"),
        "Output should contain bash completion syntax"
    );
}

/// Test powershell completions generation
#[test]
#[ignore]
fn test_completions_powershell() {
    let output = Command::new("cargo")
        .args(["run", "--", "completions", "powershell"])
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "powershell completions should generate"
    );
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("Register-ArgumentCompleter") || stdout.contains("raps"),
        "Output should contain PowerShell completion syntax"
    );
}

/// Test zsh completions generation
#[test]
#[ignore]
fn test_completions_zsh() {
    let output = Command::new("cargo")
        .args(["run", "--", "completions", "zsh"])
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success(), "zsh completions should generate");
    let stdout = String::from_utf8_lossy(&output.stdout);
    assert!(
        stdout.contains("#compdef") || stdout.contains("_raps"),
        "Output should contain zsh completion syntax"
    );
}

// ============== CONFIG COMMAND TESTS ==============

/// Test config profile list (doesn't require auth)
#[test]
#[ignore]
fn test_config_profile_list() {
    let output = Command::new("cargo")
        .args(["run", "--", "config", "profile", "list", "--output", "json"])
        .output()
        .expect("Failed to execute command");

    // This should work without authentication
    assert!(
        output.status.success(),
        "config profile list should succeed without auth"
    );
}

/// Test config profile current (doesn't require auth)
#[test]
#[ignore]
fn test_config_profile_current() {
    let output = Command::new("cargo")
        .args(["run", "--", "config", "profile", "current"])
        .output()
        .expect("Failed to execute command");

    // This should work without authentication
    assert!(
        output.status.success(),
        "config profile current should succeed without auth"
    );
}

// ============== PLUGIN COMMAND TESTS ==============

/// Test plugin list (doesn't require auth)
#[test]
#[ignore]
fn test_plugin_list() {
    let output = Command::new("cargo")
        .args(["run", "--", "plugin", "list", "--output", "json"])
        .output()
        .expect("Failed to execute command");

    // Plugin list should work without authentication
    assert!(
        output.status.success(),
        "plugin list should succeed without auth"
    );
}

/// Test plugin alias list (doesn't require auth)
#[test]
#[ignore]
fn test_plugin_alias_list() {
    let output = Command::new("cargo")
        .args(["run", "--", "plugin", "alias", "list", "--output", "json"])
        .output()
        .expect("Failed to execute command");

    // Alias list should work without authentication
    assert!(
        output.status.success(),
        "plugin alias list should succeed without auth"
    );
}