Skip to content

Commit 743042d

Browse files
committed
PYTHON-1884 Add client encryption spec test files
1 parent 7d76ee2 commit 743042d

29 files changed

+10715
-0
lines changed

test/client-side-encryption/spec/aggregate.json

Lines changed: 412 additions & 0 deletions
Large diffs are not rendered by default.

test/client-side-encryption/spec/badQueries.json

Lines changed: 1446 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.1.10"
5+
}
6+
],
7+
"database_name": "default",
8+
"collection_name": "default",
9+
"data": [],
10+
"key_vault_data": [
11+
{
12+
"status": 1,
13+
"_id": {
14+
"$binary": {
15+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
16+
"subType": "04"
17+
}
18+
},
19+
"masterKey": {
20+
"provider": "aws",
21+
"key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
22+
"region": "us-east-1"
23+
},
24+
"updateDate": {
25+
"$date": {
26+
"$numberLong": "1552949630483"
27+
}
28+
},
29+
"keyMaterial": {
30+
"$binary": {
31+
"base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO",
32+
"subType": "00"
33+
}
34+
},
35+
"creationDate": {
36+
"$date": {
37+
"$numberLong": "1552949630483"
38+
}
39+
},
40+
"keyAltNames": [
41+
"altname",
42+
"another_altname"
43+
]
44+
}
45+
],
46+
"tests": [
47+
{
48+
"description": "Schema with an encrypted field in an array",
49+
"clientOptions": {
50+
"autoEncryptOpts": {
51+
"schemaMap": {
52+
"default.default": {
53+
"properties": {
54+
"encrypted_string": {
55+
"encrypt": {
56+
"keyId": [
57+
{
58+
"$binary": {
59+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
60+
"subType": "04"
61+
}
62+
}
63+
],
64+
"bsonType": "string",
65+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
66+
}
67+
}
68+
},
69+
"bsonType": "array"
70+
}
71+
},
72+
"kmsProviders": {
73+
"aws": {}
74+
}
75+
}
76+
},
77+
"operations": [
78+
{
79+
"name": "insertOne",
80+
"arguments": {
81+
"document": {
82+
"_id": 1,
83+
"encrypted_string": "string0"
84+
}
85+
},
86+
"result": {
87+
"errorContains": "Invalid schema"
88+
}
89+
}
90+
],
91+
"outcome": {
92+
"collection": {
93+
"data": []
94+
}
95+
}
96+
},
97+
{
98+
"description": "Schema without specifying parent object types",
99+
"clientOptions": {
100+
"autoEncryptOpts": {
101+
"schemaMap": {
102+
"default.default": {
103+
"properties": {
104+
"foo": {
105+
"properties": {
106+
"bar": {
107+
"encrypt": {
108+
"keyId": [
109+
{
110+
"$binary": {
111+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
112+
"subType": "04"
113+
}
114+
}
115+
],
116+
"bsonType": "string",
117+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
118+
}
119+
}
120+
}
121+
}
122+
}
123+
}
124+
},
125+
"kmsProviders": {
126+
"aws": {}
127+
}
128+
}
129+
},
130+
"operations": [
131+
{
132+
"name": "insertOne",
133+
"arguments": {
134+
"document": {
135+
"_id": 1,
136+
"encrypted_string": "string0"
137+
}
138+
},
139+
"result": {
140+
"errorContains": "Invalid schema"
141+
}
142+
}
143+
],
144+
"outcome": {
145+
"collection": {
146+
"data": []
147+
}
148+
}
149+
},
150+
{
151+
"description": "Schema with siblings of encrypt document",
152+
"clientOptions": {
153+
"autoEncryptOpts": {
154+
"schemaMap": {
155+
"default.default": {
156+
"properties": {
157+
"encrypted_string": {
158+
"encrypt": {
159+
"keyId": [
160+
{
161+
"$binary": {
162+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
163+
"subType": "04"
164+
}
165+
}
166+
],
167+
"bsonType": "string",
168+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
169+
},
170+
"bsonType": "object"
171+
}
172+
}
173+
}
174+
},
175+
"kmsProviders": {
176+
"aws": {}
177+
}
178+
}
179+
},
180+
"operations": [
181+
{
182+
"name": "insertOne",
183+
"arguments": {
184+
"document": {
185+
"_id": 1,
186+
"encrypted_string": "string0"
187+
}
188+
},
189+
"result": {
190+
"errorContains": "'encrypt' cannot be used in conjunction with 'bsonType'"
191+
}
192+
}
193+
],
194+
"outcome": {
195+
"collection": {
196+
"data": []
197+
}
198+
}
199+
},
200+
{
201+
"description": "Schema with logical keywords",
202+
"clientOptions": {
203+
"autoEncryptOpts": {
204+
"schemaMap": {
205+
"default.default": {
206+
"anyOf": [
207+
{
208+
"properties": {
209+
"encrypted_string": {
210+
"encrypt": {
211+
"keyId": [
212+
{
213+
"$binary": {
214+
"base64": "AAAAAAAAAAAAAAAAAAAAAA==",
215+
"subType": "04"
216+
}
217+
}
218+
],
219+
"bsonType": "string",
220+
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random"
221+
}
222+
}
223+
}
224+
}
225+
]
226+
}
227+
},
228+
"kmsProviders": {
229+
"aws": {}
230+
}
231+
}
232+
},
233+
"operations": [
234+
{
235+
"name": "insertOne",
236+
"arguments": {
237+
"document": {
238+
"_id": 1,
239+
"encrypted_string": "string0"
240+
}
241+
},
242+
"result": {
243+
"errorContains": "Invalid schema"
244+
}
245+
}
246+
],
247+
"outcome": {
248+
"collection": {
249+
"data": []
250+
}
251+
}
252+
}
253+
]
254+
}

0 commit comments

Comments
 (0)