Skip to content

Commit 9c57faa

Browse files
committed
skeletal solution
1 parent 07c0840 commit 9c57faa

File tree

164 files changed

+7716
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+7716
-0
lines changed

test/test_unified_format.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2020-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
import sys
17+
18+
sys.path[0:0] = [""]
19+
20+
from test import unittest
21+
from test.unified_format import generate_test_classes
22+
23+
24+
_TEST_PATH = os.path.join(
25+
os.path.dirname(os.path.realpath(__file__)), 'unified-test-format')
26+
27+
globals().update(generate_test_classes(
28+
os.path.join(_TEST_PATH, 'valid-pass'),
29+
name_prefix='unified_test_format'))
30+
31+
32+
if __name__ == "__main__":
33+
unittest.main()
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"description": "example-insertOne",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "2.6"
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0",
13+
"observeEvents": [
14+
"commandStartedEvent"
15+
]
16+
}
17+
},
18+
{
19+
"database": {
20+
"id": "database0",
21+
"client": "client0",
22+
"databaseName": "test"
23+
}
24+
},
25+
{
26+
"collection": {
27+
"id": "collection0",
28+
"database": "database0",
29+
"collectionName": "coll"
30+
}
31+
}
32+
],
33+
"initialData": [
34+
{
35+
"collectionName": "coll",
36+
"databaseName": "test",
37+
"documents": [
38+
{
39+
"_id": 1
40+
}
41+
]
42+
}
43+
],
44+
"tests": [
45+
{
46+
"description": "insertOne",
47+
"operations": [
48+
{
49+
"object": "collection0",
50+
"name": "insertOne",
51+
"arguments": {
52+
"document": {
53+
"_id": 2
54+
}
55+
},
56+
"expectResult": {
57+
"insertedId": {
58+
"$$unsetOrMatches": 2
59+
}
60+
}
61+
}
62+
],
63+
"expectEvents": [
64+
{
65+
"client": "client0",
66+
"events": [
67+
{
68+
"commandStartedEvent": {
69+
"commandName": "insert",
70+
"databaseName": "test",
71+
"command": {
72+
"insert": "coll",
73+
"documents": [
74+
{
75+
"_id": 2
76+
}
77+
]
78+
}
79+
}
80+
}
81+
]
82+
}
83+
],
84+
"outcome": [
85+
{
86+
"collectionName": "coll",
87+
"databaseName": "test",
88+
"documents": [
89+
{
90+
"_id": 1
91+
},
92+
{
93+
"_id": 2
94+
}
95+
]
96+
}
97+
]
98+
}
99+
]
100+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"description": "collectionData-additionalProperties",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"collectionName": "foo",
29+
"databaseName": "foo",
30+
"documents": [],
31+
"foo": 0
32+
}
33+
],
34+
"tests": [
35+
{
36+
"description": "foo",
37+
"operations": []
38+
}
39+
]
40+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"description": "collectionData-collectionName-required",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"databaseName": "foo",
29+
"documents": []
30+
}
31+
],
32+
"tests": [
33+
{
34+
"description": "foo",
35+
"operations": []
36+
}
37+
]
38+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"description": "collectionData-collectionName-type",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"collectionName": 0,
29+
"databaseName": "foo",
30+
"documents": []
31+
}
32+
],
33+
"tests": [
34+
{
35+
"description": "foo",
36+
"operations": []
37+
}
38+
]
39+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"description": "collectionData-databaseName-required",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"collectionName": "foo",
29+
"documents": []
30+
}
31+
],
32+
"tests": [
33+
{
34+
"description": "foo",
35+
"operations": []
36+
}
37+
]
38+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"description": "collectionData-databaseName-type",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"collectionName": "foo",
29+
"databaseName": 0,
30+
"documents": []
31+
}
32+
],
33+
"tests": [
34+
{
35+
"description": "foo",
36+
"operations": []
37+
}
38+
]
39+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"description": "collectionData-documents-items",
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": "foo"
15+
}
16+
},
17+
{
18+
"collection": {
19+
"id": "collection0",
20+
"database": "database0",
21+
"collectionName": "foo",
22+
"foo": 0
23+
}
24+
}
25+
],
26+
"initialData": [
27+
{
28+
"collectionName": "foo",
29+
"databaseName": "foo",
30+
"documents": [
31+
0
32+
]
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "foo",
38+
"operations": []
39+
}
40+
]
41+
}

0 commit comments

Comments
 (0)