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
use assert_cmd::Command;
use predicates::str::contains;
fn base() -> Command {
let mut c = Command::cargo_bin("sharepoint").unwrap();
c.env_clear()
.env("PATH", std::env::var("PATH").unwrap_or_default())
.env(
"SHAREPOINT_TENANT_ID",
"00000000-0000-0000-0000-000000000000",
)
.env("SHAREPOINT_CLIENT_ID", "client-1");
c
}
#[test]
fn recursive_with_limit_rejected() {
base()
.args([
"--output",
"json",
"files",
"ls",
"--recursive",
"--limit",
"5",
"Lib",
])
.assert()
.code(2)
// Per the spec, errors go to stderr; the JSON envelope is the last line.
.stderr(contains("recursive"));
}
#[test]
fn recursive_with_all_rejected() {
base()
.args([
"--output",
"json",
"files",
"ls",
"--recursive",
"--all",
"Lib",
])
.assert()
.code(2)
.stderr(contains("recursive"));
}
#[test]
fn recursive_with_page_rejected() {
base()
.args([
"--output",
"json",
"files",
"ls",
"--recursive",
"--page",
"abc",
"Lib",
])
.assert()
.code(2)
.stderr(contains("recursive"));
}
#[test]
fn recursive_with_limit_200_rejected() {
// --limit 200 happens to equal the default, but because the user explicitly
// supplied it as Option<usize>::Some(200), it must still be rejected.
base()
.args([
"--output",
"json",
"files",
"ls",
"--recursive",
"--limit",
"200",
"Lib",
])
.assert()
.code(2)
.stderr(contains("recursive"));
}