Skip to content

Commit 56c90bf

Browse files
committed
Added test for legacy GridFS, where no filename was set
SPEC-895
1 parent 53c8c19 commit 56c90bf

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

source/gridfs/tests/download.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@
7575
"contentType": "application/octet-stream",
7676
"aliases": [],
7777
"metadata": {}
78+
},
79+
{
80+
"_id": {
81+
"$oid": "000000000000000000000006"
82+
},
83+
"length": 2,
84+
"chunkSize": 4,
85+
"uploadDate": {
86+
"$date": "1970-01-01T00:00:00.000Z"
87+
},
88+
"md5": "c700ed4fdb1d27055aa3faa2c2432283",
89+
"contentType": "application/octet-stream",
90+
"aliases": [],
91+
"metadata": {}
7892
}
7993
],
8094
"chunks": [
@@ -161,6 +175,18 @@
161175
"data": {
162176
"$hex": "99aa"
163177
}
178+
},
179+
{
180+
"_id": {
181+
"$oid": "000000000000000000000008"
182+
},
183+
"files_id": {
184+
"$oid": "000000000000000000000006"
185+
},
186+
"n": 0,
187+
"data": {
188+
"$hex": "1122"
189+
}
164190
}
165191
]
166192
},
@@ -419,6 +445,23 @@
419445
"assert": {
420446
"error": "ChunkIsWrongSize"
421447
}
448+
},
449+
{
450+
"description": "Download legacy file with no name",
451+
"act": {
452+
"operation": "download",
453+
"arguments": {
454+
"id": {
455+
"$oid": "000000000000000000000006"
456+
},
457+
"options": {}
458+
}
459+
},
460+
"assert": {
461+
"result": {
462+
"$hex": "1122"
463+
}
464+
}
422465
}
423466
]
424467
}

source/gridfs/tests/download.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
contentType: "application/octet-stream"
5151
aliases: []
5252
metadata: {}
53+
-
54+
_id: { "$oid" : "000000000000000000000006" }
55+
length: 2
56+
chunkSize: 4
57+
uploadDate: { "$date" : "1970-01-01T00:00:00.000Z" }
58+
md5: "c700ed4fdb1d27055aa3faa2c2432283"
59+
contentType: "application/octet-stream"
60+
aliases: []
61+
metadata: {}
5362
chunks:
5463
- { _id : { "$oid" : "000000000000000000000001" }, files_id : { "$oid" : "000000000000000000000002" }, n : 0, data : { $hex : "" } }
5564
- { _id : { "$oid" : "000000000000000000000002" }, files_id : { "$oid" : "000000000000000000000003" }, n : 0, data : { $hex : "1122" } }
@@ -58,6 +67,7 @@
5867
- { _id : { "$oid" : "000000000000000000000005" }, files_id : { "$oid" : "000000000000000000000005" }, n : 0, data : { $hex : "11223344" } }
5968
- { _id : { "$oid" : "000000000000000000000006" }, files_id : { "$oid" : "000000000000000000000005" }, n : 1, data : { $hex : "55667788" } }
6069
- { _id : { "$oid" : "000000000000000000000007" }, files_id : { "$oid" : "000000000000000000000005" }, n : 2, data : { $hex : "99aa" } }
70+
- { _id : { "$oid" : "000000000000000000000008" }, files_id : { "$oid" : "000000000000000000000006" }, n : 0, data : { $hex : "1122" } }
6171

6272
tests:
6373
-
@@ -171,3 +181,12 @@ tests:
171181
id: { "$oid" : "000000000000000000000005" }
172182
assert:
173183
error: "ChunkIsWrongSize"
184+
-
185+
description: "Download legacy file with no name"
186+
act:
187+
operation: download
188+
arguments:
189+
id: { "$oid" : "000000000000000000000006" }
190+
options: { }
191+
assert:
192+
result: { $hex : "1122" }

0 commit comments

Comments
 (0)