summaryrefslogtreecommitdiff
path: root/runtime/permissions.rs
diff options
context:
space:
mode:
authorcrowlKats <13135287+crowlKats@users.noreply.github.com>2021-02-02 18:16:24 +0100
committerGitHub <noreply@github.com>2021-02-02 18:16:24 +0100
commit9690ce5e872f1873538b8cea7c93fa3ea8bfd9d1 (patch)
tree50f1169e1f4d4fba7f62fceeff472e04c872066a /runtime/permissions.rs
parent6abf126c2a7a451cded8c6b5e6ddf1b69c84055d (diff)
refactor(runtime): remove unneeded Deserialize trait for Permissions struct (#9362)
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r--runtime/permissions.rs51
1 files changed, 1 insertions, 50 deletions
diff --git a/runtime/permissions.rs b/runtime/permissions.rs
index fdb3a425b..f9c74a253 100644
--- a/runtime/permissions.rs
+++ b/runtime/permissions.rs
@@ -68,7 +68,7 @@ pub struct UnaryPermission<T: Eq + Hash> {
pub denied_list: HashSet<T>,
}
-#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
+#[derive(Clone, Debug, Default, PartialEq)]
pub struct Permissions {
pub read: UnaryPermission<PathBuf>,
pub write: UnaryPermission<PathBuf>,
@@ -749,7 +749,6 @@ fn format_host<T: AsRef<str>>(host: &(T, Option<u16>)) -> String {
#[cfg(test)]
mod tests {
use super::*;
- use deno_core::serde_json;
// Creates vector of strings, Vec<String>
macro_rules! svec {
@@ -1065,54 +1064,6 @@ mod tests {
}
#[test]
- fn test_deserialize_perms() {
- let json_perms = r#"
- {
- "read": {
- "global_state": "Granted",
- "granted_list": [],
- "denied_list": []
- },
- "write": {
- "global_state": "Granted",
- "granted_list": [],
- "denied_list": []
- },
- "net": {
- "global_state": "Granted",
- "granted_list": [],
- "denied_list": []
- },
- "env": "Granted",
- "run": "Granted",
- "plugin": "Granted",
- "hrtime": "Granted"
- }
- "#;
- let perms0 = Permissions {
- read: UnaryPermission {
- global_state: PermissionState::Granted,
- ..Default::default()
- },
- write: UnaryPermission {
- global_state: PermissionState::Granted,
- ..Default::default()
- },
- net: UnaryPermission {
- global_state: PermissionState::Granted,
- ..Default::default()
- },
- env: PermissionState::Granted,
- run: PermissionState::Granted,
- hrtime: PermissionState::Granted,
- plugin: PermissionState::Granted,
- };
- let deserialized_perms: Permissions =
- serde_json::from_str(json_perms).unwrap();
- assert_eq!(perms0, deserialized_perms);
- }
-
- #[test]
fn test_query() {
let perms1 = Permissions {
read: UnaryPermission {