-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfolder_privacy_test.rs
65 lines (57 loc) · 2.04 KB
/
folder_privacy_test.rs
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
use assert_cmd::prelude::*;
use predicates::prelude::*;
use std::{error::Error, process::Command};
mod common;
#[test]
fn test_check() -> Result<(), Box<dyn Error>> {
Command::cargo_bin("pks")?
.arg("--project-root")
.arg("tests/fixtures/folder_privacy_violations")
.arg("--debug")
.arg("check")
.assert()
.failure()
.stdout(predicate::str::contains("Folder Privacy violation: `::Foo` belongs to `packs/foos/foo`, which is private to `packs/baz` as it is not a sibling pack or parent pack."));
common::teardown();
Ok(())
}
#[test]
fn test_check_with_error_template_overrides() -> Result<(), Box<dyn Error>> {
Command::cargo_bin("pks")?
.arg("--project-root")
.arg("tests/fixtures/folder_privacy_violations_with_overrides")
.arg("--debug")
.arg("check")
.assert()
.failure()
.stdout(predicate::str::contains("Folder Privacy violation: `::Foo` belongs to the `packs/foos/foo` product service, which is not visible to `packs/baz` as it is a different product service. See https://docs.google.com"));
common::teardown();
Ok(())
}
#[test]
fn test_check_enforce_folder_privacy_disabled() -> Result<(), Box<dyn Error>> {
Command::cargo_bin("pks")?
.arg("--project-root")
.arg("tests/fixtures/folder_privacy_violations")
.arg("--debug")
.arg("--disable-enforce-folder-privacy")
.arg("check")
.assert()
.success();
common::teardown();
Ok(())
}
#[test]
fn test_invisible_pack_violation_with_deprecated_enforce_folder_visibility(
) -> Result<(), Box<dyn Error>> {
Command::cargo_bin("pks")?
.arg("--project-root")
.arg("tests/fixtures/folder_visibility_violations")
.arg("--debug")
.arg("check")
.assert()
.failure()
.stdout(predicate::str::contains("Folder Privacy violation: `::Foo` belongs to `packs/foos/foo`, which is private to `packs/baz` as it is not a sibling pack or parent pack."));
common::teardown();
Ok(())
}