summaryrefslogtreecommitdiff
path: root/cli/tests/integration/run_tests.rs
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2023-02-23 09:02:10 +1100
committerGitHub <noreply@github.com>2023-02-22 23:02:10 +0100
commitc18e0d1d37878bb4441f7f8d339cc23ac8e68448 (patch)
tree8b4007aec8cef00fc605c56e6001b2d92f10987a /cli/tests/integration/run_tests.rs
parent5fcbdd62285140353edbb28e67f7d72e3317e96e (diff)
feat(permissions): grant all permission for a group in permission prompt (#17140)
This commit adds new "A" option to the interactive permission prompt, that will allow all subsequent permissions for given group (domain). Ie. when querying for permissions to access eg. env variables responding with "A" will allow access to all environmental variables. This works for all permission domains and should make permission prompts more ergonomic for users.
Diffstat (limited to 'cli/tests/integration/run_tests.rs')
-rw-r--r--cli/tests/integration/run_tests.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index d42136f84..10ff6d2e0 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -591,6 +591,62 @@ fn _090_run_permissions_request_sync() {
]);
}
+#[test]
+fn permissions_prompt_allow_all() {
+ let args = "run --quiet run/permissions_prompt_allow_all.ts";
+ use util::PtyData::*;
+ util::test_pty2(args, vec![
+ // "run" permissions
+ Output("┌ ⚠️ Deno requests run access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-run to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all run permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all run access.\r\n"),
+ // "read" permissions
+ Output("┌ ⚠️ Deno requests read access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-read to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all read access.\r\n"),
+ // "write" permissions
+ Output("┌ ⚠️ Deno requests write access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-write to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all write permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all write access.\r\n"),
+ // "net" permissions
+ Output("┌ ⚠️ Deno requests net access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-net to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all net permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all net access.\r\n"),
+ // "env" permissions
+ Output("┌ ⚠️ Deno requests env access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-env to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all env permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all env access.\r\n"),
+ // "sys" permissions
+ Output("┌ ⚠️ Deno requests sys access to \"loadavg\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-sys to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all sys permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all sys access.\r\n"),
+ // "ffi" permissions
+ Output("┌ ⚠️ Deno requests ffi access to \"FOO\".\r\n├ Requested by `Deno.permissions.query()` API\r\n ├ Run again with --allow-ffi to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all ffi permissions) >"),
+ Input("a\n"),
+ Output("✅ Granted all ffi access.\r\n")
+ ]);
+}
+
+#[test]
+fn permissions_prompt_allow_all_2() {
+ let args = "run --quiet run/permissions_prompt_allow_all_2.ts";
+ use util::PtyData::*;
+ util::test_pty2(args, vec![
+ // "env" permissions
+ Output("┌ ⚠️ Deno requests env access to \"FOO\".\r\n├ Run again with --allow-env to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all env permissions) >"),
+ Input("d\n"),
+ Output("✅ Granted all env access.\r\n"),
+ // "sys" permissions
+ Output("┌ ⚠️ Deno requests sys access to \"FOO\".\r\n├ Run again with --allow-sys to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all sys permissions) >"),
+ Input("d\n"),
+ Output("✅ Granted all sys access.\r\n"),
+ // "read" permissions
+ Output("┌ ⚠️ Deno requests read access to \"FOO\".\r\n├ Run again with --allow-read to bypass this prompt.\r\n└ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all read permissions) >"),
+ Input("d\n"),
+ Output("✅ Granted all read access.\r\n"),
+ ]);
+}
+
itest!(_091_use_define_for_class_fields {
args: "run --check run/091_use_define_for_class_fields.ts",
output: "run/091_use_define_for_class_fields.ts.out",