...

Text file src/go.mongodb.org/mongo-driver/testdata/gridfs/upload-disableMD5.yml

Documentation: go.mongodb.org/mongo-driver/testdata/gridfs

     1description: "gridfs-upload-disableMD5"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     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
    24initialData:
    25  - collectionName: *bucket0_files_collectionName
    26    databaseName: *database0Name
    27    documents: []
    28  - collectionName: *bucket0_chunks_collectionName
    29    databaseName: *database0Name
    30    documents: []
    31
    32# Note: these tests utilize the transitional "disableMD5" option. Drivers that
    33# do not support the option should skip this file.
    34tests:
    35  - description: "upload when length is 0 sans MD5"
    36    operations:
    37      - name: upload
    38        object: *bucket0
    39        arguments:
    40          filename: "filename"
    41          source: { $$hexBytes: "" }
    42          chunkSizeBytes: 4
    43          disableMD5: true
    44        expectResult: { $$type: objectId }
    45        saveResultAsEntity: &uploadedObjectId uploadedObjectId
    46      - name: find
    47        object: *bucket0_files_collection
    48        arguments:
    49          filter: {}
    50        expectResult:
    51          - _id: { $$matchesEntity: *uploadedObjectId }
    52            length: 0
    53            chunkSize: 4
    54            uploadDate: { $$type: date }
    55            md5: { $$exists: false }
    56            filename: filename
    57      - name: find
    58        object: *bucket0_chunks_collection
    59        arguments:
    60          filter: {}
    61        expectResult: []
    62  - description: "upload when length is 1 sans MD5"
    63    operations:
    64      - name: upload
    65        object: *bucket0
    66        arguments:
    67          filename: "filename"
    68          source: { $$hexBytes: "11" }
    69          chunkSizeBytes: 4
    70          disableMD5: true
    71        expectResult: { $$type: objectId }
    72        saveResultAsEntity: *uploadedObjectId
    73      - name: find
    74        object: *bucket0_files_collection
    75        arguments:
    76          filter: {}
    77        expectResult:
    78          - _id: { $$matchesEntity: *uploadedObjectId }
    79            length: 1
    80            chunkSize: 4
    81            uploadDate: { $$type: date }
    82            md5: { $$exists: false }
    83            filename: filename
    84      - name: find
    85        object: *bucket0_chunks_collection
    86        arguments:
    87          filter: {}
    88        expectResult:
    89          - _id: { $$type: objectId }
    90            files_id: { $$matchesEntity: *uploadedObjectId }
    91            n: 0
    92            data: { $binary: { base64: "EQ==", subType: "00" } } # hex 11

View as plain text