...

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

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

     1{
     2  "description": "gridfs-upload-disableMD5",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0"
     8      }
     9    },
    10    {
    11      "database": {
    12        "id": "database0",
    13        "client": "client0",
    14        "databaseName": "gridfs-tests"
    15      }
    16    },
    17    {
    18      "bucket": {
    19        "id": "bucket0",
    20        "database": "database0"
    21      }
    22    },
    23    {
    24      "collection": {
    25        "id": "bucket0_files_collection",
    26        "database": "database0",
    27        "collectionName": "fs.files"
    28      }
    29    },
    30    {
    31      "collection": {
    32        "id": "bucket0_chunks_collection",
    33        "database": "database0",
    34        "collectionName": "fs.chunks"
    35      }
    36    }
    37  ],
    38  "initialData": [
    39    {
    40      "collectionName": "fs.files",
    41      "databaseName": "gridfs-tests",
    42      "documents": []
    43    },
    44    {
    45      "collectionName": "fs.chunks",
    46      "databaseName": "gridfs-tests",
    47      "documents": []
    48    }
    49  ],
    50  "tests": [
    51    {
    52      "description": "upload when length is 0 sans MD5",
    53      "operations": [
    54        {
    55          "name": "upload",
    56          "object": "bucket0",
    57          "arguments": {
    58            "filename": "filename",
    59            "source": {
    60              "$$hexBytes": ""
    61            },
    62            "chunkSizeBytes": 4,
    63            "disableMD5": true
    64          },
    65          "expectResult": {
    66            "$$type": "objectId"
    67          },
    68          "saveResultAsEntity": "uploadedObjectId"
    69        },
    70        {
    71          "name": "find",
    72          "object": "bucket0_files_collection",
    73          "arguments": {
    74            "filter": {}
    75          },
    76          "expectResult": [
    77            {
    78              "_id": {
    79                "$$matchesEntity": "uploadedObjectId"
    80              },
    81              "length": 0,
    82              "chunkSize": 4,
    83              "uploadDate": {
    84                "$$type": "date"
    85              },
    86              "md5": {
    87                "$$exists": false
    88              },
    89              "filename": "filename"
    90            }
    91          ]
    92        },
    93        {
    94          "name": "find",
    95          "object": "bucket0_chunks_collection",
    96          "arguments": {
    97            "filter": {}
    98          },
    99          "expectResult": []
   100        }
   101      ]
   102    },
   103    {
   104      "description": "upload when length is 1 sans MD5",
   105      "operations": [
   106        {
   107          "name": "upload",
   108          "object": "bucket0",
   109          "arguments": {
   110            "filename": "filename",
   111            "source": {
   112              "$$hexBytes": "11"
   113            },
   114            "chunkSizeBytes": 4,
   115            "disableMD5": true
   116          },
   117          "expectResult": {
   118            "$$type": "objectId"
   119          },
   120          "saveResultAsEntity": "uploadedObjectId"
   121        },
   122        {
   123          "name": "find",
   124          "object": "bucket0_files_collection",
   125          "arguments": {
   126            "filter": {}
   127          },
   128          "expectResult": [
   129            {
   130              "_id": {
   131                "$$matchesEntity": "uploadedObjectId"
   132              },
   133              "length": 1,
   134              "chunkSize": 4,
   135              "uploadDate": {
   136                "$$type": "date"
   137              },
   138              "md5": {
   139                "$$exists": false
   140              },
   141              "filename": "filename"
   142            }
   143          ]
   144        },
   145        {
   146          "name": "find",
   147          "object": "bucket0_chunks_collection",
   148          "arguments": {
   149            "filter": {}
   150          },
   151          "expectResult": [
   152            {
   153              "_id": {
   154                "$$type": "objectId"
   155              },
   156              "files_id": {
   157                "$$matchesEntity": "uploadedObjectId"
   158              },
   159              "n": 0,
   160              "data": {
   161                "$binary": {
   162                  "base64": "EQ==",
   163                  "subType": "00"
   164                }
   165              }
   166            }
   167          ]
   168        }
   169      ]
   170    }
   171  ]
   172}

View as plain text