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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//! Assign permissions to a user.
use ;
use cratePermission;
use crate::;
/// Assign user permissions.
///
/// # Scopes
/// * `update:users`
///
/// # Example
/// ```
/// async fn add_permission() {}
/// ```
// #[cfg(test)]
// mod tests {
// use crate::Auth0RequestBuilder;
// use crate::{Permission, UserPermissionsUpdate};
// use reqwest::Client;
//
// #[test]
// fn test_create() {
// let req = UserPermissionsUpdate::new("USER_ID")
// .permission(Permission {
// name: "test1".to_string(),
// description: "test1".to_string(),
// resource_server_name: "test1".to_string(),
// resource_server_identifier: "test1".to_string(),
// })
// .permissions(&[
// Permission {
// name: "test2".to_string(),
// description: "test2".to_string(),
// resource_server_name: "test2".to_string(),
// resource_server_identifier: "test2".to_string(),
// },
// Permission {
// name: "test3".to_string(),
// description: "test3".to_string(),
// resource_server_name: "test3".to_string(),
// resource_server_identifier: "test3".to_string(),
// },
// ])
// .build(|method, path| {
// Client::new().request(method, &format!("https://ipsum/{}", path))
// })
// .build()
// .unwrap();
//
// let body: Vec<Permission> =
// serde_json::from_reader(req.body().unwrap().as_bytes().unwrap()).unwrap();
//
// assert_eq!(req.url().path(), "/api/v2/users/USER_ID/permissions");
// assert_eq!(body.len(), 3);
// assert_eq!(body.first().unwrap().name, "test1");
// assert_eq!(body.last().unwrap().name, "test3");
// }
// }