MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_inmemorydrive_get_update_acls

Function test_inmemorydrive_get_update_acls

std/src/storage/mem.rs:148–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146
147 #[tokio::test]
148 async fn test_inmemorydrive_get_update_acls() {
149 let mut drive = InMemoryDrive::default();
150 drive.put("untouched", b"some content").await.unwrap();
151
152 let err =
153 drive.update_acls("file", &readers(&["r0"]), &FileAcls::default()).await.unwrap_err();
154 assert_eq!(io::ErrorKind::NotFound, err.kind());
155
156 drive.put("file", b"some content").await.unwrap();
157 assert_eq!(FileAcls::default(), drive.get_acls("file").await.unwrap());
158
159 // Add some new readers and try to remove a non-existing one.
160 drive.update_acls("file", &readers(&["r1", "r2"]), &readers(&["r3"])).await.unwrap();
161 assert_eq!(readers(&["r1", "r2"]), drive.get_acls("file").await.unwrap());
162
163 // Add a new reader and a duplicate and remove an existing one.
164 drive.update_acls("file", &readers(&["r2", "r2", "r3"]), &readers(&["r1"])).await.unwrap();
165 assert_eq!(readers(&["r2", "r3"]), drive.get_acls("file").await.unwrap());
166
167 // Make sure other files were not affected.
168 assert_eq!(FileAcls::default(), drive.get_acls("untouched").await.unwrap());
169 }
170
171 #[test]
172 fn test_inmemorydrive_system_path() {

Callers

nothing calls this directly

Calls 3

readersFunction · 0.85
putMethod · 0.45
update_aclsMethod · 0.45

Tested by

no test coverage detected