| 103 | |
| 104 | |
| 105 | TEST_F(FilesTest, AttachTest) |
| 106 | { |
| 107 | Files files; |
| 108 | ASSERT_SOME(os::write("file", "body")); |
| 109 | ASSERT_SOME(os::mkdir("dir")); |
| 110 | |
| 111 | AWAIT_EXPECT_READY(files.attach("file", "myname")); // Valid file. |
| 112 | AWAIT_EXPECT_READY(files.attach("dir", "mydir")); // Valid dir. |
| 113 | AWAIT_EXPECT_READY(files.attach("file", "myname")); // Re-attach. |
| 114 | AWAIT_EXPECT_FAILED(files.attach("missing", "somename")); // Missing file. |
| 115 | |
| 116 | auto authorization = [](const Option<Principal>&) { return true; }; |
| 117 | |
| 118 | // Attach with required authorization. |
| 119 | AWAIT_EXPECT_READY(files.attach("file", "myname", authorization)); |
| 120 | |
| 121 | ASSERT_SOME(os::write("file2", "body")); |
| 122 | |
| 123 | AWAIT_EXPECT_READY(files.attach("file2", "myname")); // Overwrite. |
| 124 | AWAIT_EXPECT_FAILED(files.attach("$@", "foo")); // Bad path. |
| 125 | } |
| 126 | |
| 127 | |
| 128 | TEST_F(FilesTest, DetachTest) |
nothing calls this directly
no test coverage detected