Skip to content

Commit 6cbaed3

Browse files
aherlihybehackett
authored andcommitted
PYTHON-822: Added CRUD YAML tests.
1 parent 657c511 commit 6cbaed3

15 files changed

+2155
-0
lines changed

test/crud/read/aggregate.json

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"data": [
3+
{
4+
"_id": 1,
5+
"x": 11
6+
},
7+
{
8+
"_id": 2,
9+
"x": 22
10+
},
11+
{
12+
"_id": 3,
13+
"x": 33
14+
}
15+
],
16+
"tests": [
17+
{
18+
"description": "Aggregate with multiple stages",
19+
"operation": {
20+
"name": "aggregate",
21+
"arguments": {
22+
"pipeline": [
23+
{
24+
"$sort": {
25+
"x": 1
26+
}
27+
},
28+
{
29+
"$match": {
30+
"_id": {
31+
"$gt": 1
32+
}
33+
}
34+
}
35+
],
36+
"batchSize": 2
37+
}
38+
},
39+
"outcome": {
40+
"result": [
41+
{
42+
"_id": 2,
43+
"x": 22
44+
},
45+
{
46+
"_id": 3,
47+
"x": 33
48+
}
49+
]
50+
}
51+
},
52+
{
53+
"description": "Aggregate with $out",
54+
"operation": {
55+
"name": "aggregate",
56+
"arguments": {
57+
"pipeline": [
58+
{
59+
"$sort": {
60+
"x": 1
61+
}
62+
},
63+
{
64+
"$match": {
65+
"_id": {
66+
"$gt": 1
67+
}
68+
}
69+
},
70+
{
71+
"$out": "other_test_collection"
72+
}
73+
],
74+
"batchSize": 2
75+
}
76+
},
77+
"outcome": {
78+
"result": [
79+
{
80+
"_id": 2,
81+
"x": 22
82+
},
83+
{
84+
"_id": 3,
85+
"x": 33
86+
}
87+
],
88+
"collection": {
89+
"name": "other_test_collection",
90+
"data": [
91+
{
92+
"_id": 2,
93+
"x": 22
94+
},
95+
{
96+
"_id": 3,
97+
"x": 33
98+
}
99+
]
100+
}
101+
}
102+
}
103+
]
104+
}

test/crud/read/count.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"data": [
3+
{
4+
"_id": 1,
5+
"x": 11
6+
},
7+
{
8+
"_id": 2,
9+
"x": 22
10+
},
11+
{
12+
"_id": 3,
13+
"x": 33
14+
}
15+
],
16+
"tests": [
17+
{
18+
"description": "Count without a filter",
19+
"operation": {
20+
"name": "count",
21+
"arguments": {
22+
"filter": {}
23+
}
24+
},
25+
"outcome": {
26+
"result": 3
27+
}
28+
},
29+
{
30+
"description": "Count with a filter",
31+
"operation": {
32+
"name": "count",
33+
"arguments": {
34+
"filter": {
35+
"_id": {
36+
"$gt": 1
37+
}
38+
}
39+
}
40+
},
41+
"outcome": {
42+
"result": 2
43+
}
44+
},
45+
{
46+
"description": "Count with skip and limit",
47+
"operation": {
48+
"name": "count",
49+
"arguments": {
50+
"filter": {},
51+
"skip": 1,
52+
"limit": 3
53+
}
54+
},
55+
"outcome": {
56+
"result": 2
57+
}
58+
}
59+
]
60+
}

test/crud/read/distinct.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"data": [
3+
{
4+
"_id": 1,
5+
"x": 11
6+
},
7+
{
8+
"_id": 2,
9+
"x": 22
10+
},
11+
{
12+
"_id": 3,
13+
"x": 33
14+
}
15+
],
16+
"tests": [
17+
{
18+
"description": "Distinct without a filter",
19+
"operation": {
20+
"name": "distinct",
21+
"arguments": {
22+
"fieldName": "x",
23+
"filter": {}
24+
}
25+
},
26+
"outcome": {
27+
"result": [
28+
11,
29+
22,
30+
33
31+
]
32+
}
33+
},
34+
{
35+
"description": "Distinct with a filter",
36+
"operation": {
37+
"name": "distinct",
38+
"arguments": {
39+
"fieldName": "x",
40+
"filter": {
41+
"_id": {
42+
"$gt": 1
43+
}
44+
}
45+
}
46+
},
47+
"outcome": {
48+
"result": [
49+
22,
50+
33
51+
]
52+
}
53+
}
54+
]
55+
}

test/crud/read/find.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"data": [
3+
{
4+
"_id": 1,
5+
"x": 11
6+
},
7+
{
8+
"_id": 2,
9+
"x": 22
10+
},
11+
{
12+
"_id": 3,
13+
"x": 33
14+
},
15+
{
16+
"_id": 4,
17+
"x": 44
18+
},
19+
{
20+
"_id": 5,
21+
"x": 55
22+
}
23+
],
24+
"tests": [
25+
{
26+
"description": "Find with filter",
27+
"operation": {
28+
"name": "find",
29+
"arguments": {
30+
"filter": {
31+
"_id": 1
32+
}
33+
}
34+
},
35+
"outcome": {
36+
"result": [
37+
{
38+
"_id": 1,
39+
"x": 11
40+
}
41+
]
42+
}
43+
},
44+
{
45+
"description": "Find with filter, sort, skip, and limit",
46+
"operation": {
47+
"name": "find",
48+
"arguments": {
49+
"filter": {
50+
"_id": {
51+
"$gt": 2
52+
}
53+
},
54+
"sort": {
55+
"_id": 1
56+
},
57+
"skip": 2,
58+
"limit": 2
59+
}
60+
},
61+
"outcome": {
62+
"result": [
63+
{
64+
"_id": 5,
65+
"x": 55
66+
}
67+
]
68+
}
69+
},
70+
{
71+
"description": "Find with limit, sort, and batchsize",
72+
"operation": {
73+
"name": "find",
74+
"arguments": {
75+
"filter": {},
76+
"sort": {
77+
"_id": 1
78+
},
79+
"limit": 4,
80+
"batchSize": 2
81+
}
82+
},
83+
"outcome": {
84+
"result": [
85+
{
86+
"_id": 1,
87+
"x": 11
88+
},
89+
{
90+
"_id": 2,
91+
"x": 22
92+
},
93+
{
94+
"_id": 3,
95+
"x": 33
96+
},
97+
{
98+
"_id": 4,
99+
"x": 44
100+
}
101+
]
102+
}
103+
}
104+
]
105+
}

0 commit comments

Comments
 (0)