Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions crates/tinycomputer/src/tinybus_module/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ impl BrowserDefaults {
let expected_egress_keys = 2 + usize::from(
cfg!(feature = "test-connector") && egress.contains_key("test_connector_map"),
);
if egress.len() != expected_egress_keys
|| browser.contains_key("args")
|| browser.contains_key("executable")
{
if egress.len() != expected_egress_keys || browser.contains_key("args") {
return Err(invalid());
}
Some(BrowserEgressConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ fn the_browser_configuration_is_read_or_refused() {
.unwrap();
assert_eq!(egress.egress.as_ref().unwrap().policy_id, "host-policy");
assert_eq!(egress.egress.as_ref().unwrap().generation, 7);
let egress_with_executable = BrowserDefaults::from_config(&json!({"browser": {
"executable": "/usr/bin/chromium",
"egress": {"policy_id": "host-policy", "generation": 7}
}}))
.unwrap();
assert_eq!(
egress_with_executable.executable.as_deref(),
Some("/usr/bin/chromium")
);
assert_eq!(
egress_with_executable.egress.as_ref().unwrap().policy_id,
"host-policy"
);
assert_eq!(
egress_with_executable.egress.as_ref().unwrap().generation,
7
);
// Settling promptly and opening the browser early are on unless turned
// off.
let unset = BrowserDefaults::default();
Expand Down
Loading