|
| 1 | +description: "gridfs-deleteByName" |
| 2 | + |
| 3 | +schemaVersion: "1.0" |
| 4 | + |
| 5 | +createEntities: |
| 6 | + - client: |
| 7 | + id: &client0 client0 |
| 8 | + - database: |
| 9 | + id: &database0 database0 |
| 10 | + client: *client0 |
| 11 | + databaseName: &database0Name gridfs-tests |
| 12 | + - bucket: |
| 13 | + id: &bucket0 bucket0 |
| 14 | + database: *database0 |
| 15 | + - collection: |
| 16 | + id: &bucket0_files_collection bucket0_files_collection |
| 17 | + database: *database0 |
| 18 | + collectionName: &bucket0_files_collectionName fs.files |
| 19 | + - collection: |
| 20 | + id: &bucket0_chunks_collection bucket0_chunks_collection |
| 21 | + database: *database0 |
| 22 | + collectionName: &bucket0_chunks_collectionName fs.chunks |
| 23 | + |
| 24 | +initialData: |
| 25 | + - collectionName: *bucket0_files_collectionName |
| 26 | + databaseName: *database0Name |
| 27 | + documents: |
| 28 | + - &file1 |
| 29 | + _id: { "$oid": "000000000000000000000001" } |
| 30 | + length: 0 |
| 31 | + chunkSize: 4 |
| 32 | + uploadDate: { "$date": "1970-01-01T00:00:00.000Z" } |
| 33 | + filename: "filename" |
| 34 | + metadata: {} |
| 35 | + - &file2 |
| 36 | + _id: { "$oid": "000000000000000000000002" } |
| 37 | + length: 0 |
| 38 | + chunkSize: 4 |
| 39 | + uploadDate: { "$date": "1970-01-01T00:00:00.000Z" } |
| 40 | + filename: "filename" |
| 41 | + metadata: {} |
| 42 | + - &file3 |
| 43 | + _id: { "$oid": "000000000000000000000003" } |
| 44 | + length: 2 |
| 45 | + chunkSize: 4 |
| 46 | + uploadDate: { "$date": "1970-01-01T00:00:00.000Z" } |
| 47 | + filename: "filename" |
| 48 | + metadata: {} |
| 49 | + - &file4 |
| 50 | + _id: { "$oid": "000000000000000000000004" } |
| 51 | + length: 8 |
| 52 | + chunkSize: 4 |
| 53 | + uploadDate: { "$date": "1970-01-01T00:00:00.000Z" } |
| 54 | + filename: "otherfilename" |
| 55 | + metadata: {} |
| 56 | + - collectionName: *bucket0_chunks_collectionName |
| 57 | + databaseName: *database0Name |
| 58 | + documents: |
| 59 | + - &file2_chunk0 |
| 60 | + _id: { "$oid": "000000000000000000000001" } |
| 61 | + files_id: { "$oid": "000000000000000000000002" } |
| 62 | + n: 0 |
| 63 | + data: { "$binary": { "base64": "", "subType": "00" } } |
| 64 | + - &file3_chunk0 |
| 65 | + _id: { "$oid": "000000000000000000000002" } |
| 66 | + files_id: { "$oid": "000000000000000000000003" } |
| 67 | + n: 0 |
| 68 | + data: { "$binary": { "base64": "", "subType": "00" } } |
| 69 | + - &file3_chunk1 |
| 70 | + _id: { "$oid": "000000000000000000000003" } |
| 71 | + files_id: { "$oid": "000000000000000000000003" } |
| 72 | + n: 0 |
| 73 | + data: { "$binary": { "base64": "", "subType": "00" } } |
| 74 | + - &file4_chunk0 |
| 75 | + _id: { "$oid": "000000000000000000000004" } |
| 76 | + files_id: { "$oid": "000000000000000000000004" } |
| 77 | + n: 0 |
| 78 | + data: { "$binary": { "base64": "", "subType": "00" } } |
| 79 | + |
| 80 | +tests: |
| 81 | + - description: "delete when multiple revisions of the file exist" |
| 82 | + operations: |
| 83 | + - name: deleteByName |
| 84 | + object: *bucket0 |
| 85 | + arguments: |
| 86 | + filename: filename |
| 87 | + outcome: |
| 88 | + - collectionName: *bucket0_files_collectionName |
| 89 | + databaseName: *database0Name |
| 90 | + documents: |
| 91 | + - <<: *file4 |
| 92 | + - collectionName: *bucket0_chunks_collectionName |
| 93 | + databaseName: *database0Name |
| 94 | + documents: |
| 95 | + - *file4_chunk0 |
| 96 | + - description: "delete when file name does not exist" |
| 97 | + operations: |
| 98 | + - name: deleteByName |
| 99 | + object: *bucket0 |
| 100 | + arguments: |
| 101 | + filename: missing-file |
| 102 | + expectError: { isError: true } # FileNotFound |
0 commit comments