| 754 | #[test] |
| 755 | #[ignore = "Requires environment configuration and is expensive"] |
| 756 | fn test_acls_private() { |
| 757 | #[tokio::main] |
| 758 | async fn run(context: &mut TestContext) { |
| 759 | let (filename, content) = context.random_file(); |
| 760 | |
| 761 | let username1 = context.get_username(1); |
| 762 | let username2 = context.get_username(2); |
| 763 | |
| 764 | // Share username1's file with username2. |
| 765 | context.do_login(1).await; |
| 766 | context |
| 767 | .service |
| 768 | .patch_file_content(&username1, &filename, content.clone()) |
| 769 | .await |
| 770 | .unwrap(); |
| 771 | |
| 772 | // Read username1's file as username2 before it is shared. |
| 773 | context.do_login(2).await; |
| 774 | let err = context.service.get_file(&username1, &filename).await.unwrap_err(); |
| 775 | assert_eq!(io::ErrorKind::NotFound, err.kind(), "{}", err); |
| 776 | |
| 777 | // Share username1's file with username2. |
| 778 | context.do_login(1).await; |
| 779 | context |
| 780 | .service |
| 781 | .patch_file_acls( |
| 782 | &username1, |
| 783 | &filename, |
| 784 | &FileAcls::default().with_readers([username2]), |
| 785 | &FileAcls::default(), |
| 786 | ) |
| 787 | .await |
| 788 | .unwrap(); |
| 789 | |
| 790 | // Read username1's file as username2 again, now that it is shared. |
| 791 | context.do_login(2).await; |
| 792 | let response = context.service.get_file(&username1, &filename).await.unwrap(); |
| 793 | assert_eq!(content, response); |
| 794 | } |
| 795 | run(&mut TestContext::new_from_env()); |
| 796 | } |
| 797 | |
| 798 | #[test] |
| 799 | #[ignore = "Requires environment configuration and is expensive"] |