Skip to content

Commit 1657bfe

Browse files
Achanandhi-MAchanandhiSonichigo
authored andcommitted
chore: update flask mongo tests docs (#509)
* fixed:flask-mongo-quickstart Signed-off-by: Achanandhi <[email protected]> * chore: update flask mongo test Signed-off-by: Achanandhi <[email protected]> Signed-off-by: Achanandhi <[email protected]> --------- Signed-off-by: Achanandhi <[email protected]> Signed-off-by: Achanandhi <[email protected]> Co-authored-by: Achanandhi <[email protected]> Co-authored-by: Animesh Pathak <[email protected]>
1 parent 99bccdd commit 1657bfe

File tree

1 file changed

+30
-49
lines changed

1 file changed

+30
-49
lines changed

versioned_docs/version-2.0.0/quickstart/python-flask-mongo.md

Lines changed: 30 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -93,72 +93,53 @@ curl -X DELETE http://localhost:6000/students/12345
9393
And once you are done, you can stop the recording and give yourself a pat on the back! With that simple spell, you've conjured up a test case with a mock! Explore the **keploy** directory and you'll discover your handiwork in `tests` directory and `mocks.yml`.
9494

9595
```yaml
96+
# Generated by Keploy (2.4.16)
9697
version: api.keploy.io/v1beta1
9798
kind: Http
9899
name: test-1
99100
spec:
100101
metadata: {}
101102
req:
102-
method: GET
103+
method: POST
103104
proto_major: 1
104105
proto_minor: 1
105-
url: http://localhost:5000/api/tasks
106+
url: http://localhost:6000/students
106107
header:
107108
Accept: "*/*"
108-
Accept-Encoding: gzip, deflate, br
109-
Cache-Control: no-cache
110-
Connection: keep-alive
111-
Content-Length: "59"
109+
Content-Length: "54"
112110
Content-Type: application/json
113-
Host: localhost:5000
114-
Postman-Token: 10512b5c-4da7-4ef3-b145-101cdd1357f1
115-
User-Agent: PostmanRuntime/7.32.1
116-
body: '{"title": "Task 6","description": "Description for Task 6"}'
117-
timestamp: 2024-04-22T16:38:39.232565209+05:30
111+
Host: localhost:6000
112+
User-Agent: curl/8.7.1
113+
body: '{"student_id": "12345", "name": "John Doe", "age": 20}'
114+
timestamp: 2025-04-02T13:12:05.255523333Z
118115
resp:
119116
status_code: 200
120117
header:
121-
Access-Control-Allow-Origin: "*"
122-
Content-Length: "267"
118+
Content-Length: "48"
123119
Content-Type: application/json
124-
Date: Mon, 22 Apr 2024 11:08:39 GMT
125-
Server: Werkzeug/3.0.2 Python/3.10.12
120+
Date: Wed, 02 Apr 2025 13:12:05 GMT
121+
Server: Werkzeug/2.2.2 Python/3.9.21
126122
body: |
127123
{
128-
"tasks": [
129-
{
130-
"description": "should update",
131-
"id": "6626362fc7c5eddf174c88e4",
132-
"title": "Updated"
133-
},
134-
{
135-
"description": "Should work",
136-
"id": "66263667c7c5eddf174c88e5",
137-
"title": "Let's Check another time"
138-
}
139-
]
124+
"message": "Student created successfully"
140125
}
141126
status_message: OK
142127
proto_major: 0
143128
proto_minor: 0
144-
timestamp: 2024-04-22T16:38:41.245704918+05:30
129+
timestamp: 2025-04-02T13:12:07.292707847Z
145130
objects: []
146131
assertions:
147132
noise:
148133
header.Date: []
149-
created: 1713784121
134+
created: 1743599527
150135
curl: |-
151-
curl --request GET \
152-
--url http://localhost:5000/api/tasks \
153-
--header 'Host: localhost:5000' \
154-
--header 'User-Agent: PostmanRuntime/7.32.1' \
136+
curl --request POST \
137+
--url http://localhost:6000/students \
138+
--header 'Host: localhost:6000' \
139+
--header 'User-Agent: curl/8.7.1' \
155140
--header 'Accept: */*' \
156141
--header 'Content-Type: application/json' \
157-
--header 'Connection: keep-alive' \
158-
--header 'Cache-Control: no-cache' \
159-
--header 'Postman-Token: 10512b5c-4da7-4ef3-b145-101cdd1357f1' \
160-
--header 'Accept-Encoding: gzip, deflate, br' \
161-
--data '{"title": "Task 6","description": "Description for Task 6"}'
142+
--data "{\"student_id\": \"12345\", \"name\": \"John Doe\", \"age\": 20}"
162143
```
163144
164145
This is how the `mocks.yml` looks like:
@@ -169,38 +150,38 @@ kind: Mongo
169150
name: mock-0
170151
spec:
171152
metadata:
172-
operation: '{ OpQuery flags: [], fullCollectionName: admin.$cmd, numberToSkip: 0, numberToReturn: -1, query: {"ismaster": {"$numberInt":"1"},"helloOk": true,"client": {"driver": {"name": "PyMongo","version": "4.6.3"},"os": {"type": "Linux","name": "Linux","architecture": "x86_64","version": "5.15.146.1-microsoft-standard-WSL2"},"platform": "CPython 3.10.12.final.0"}}, returnFieldsSelector: }'
153+
operation: '{ OpQuery flags: [], fullCollectionName: admin.$cmd, numberToSkip: 0, numberToReturn: -1, query: {"ismaster": {"$numberInt":"1"},"helloOk": true,"client": {"driver": {"name": "PyMongo","version": "4.4.1"},"os": {"type": "Linux","name": "Linux","architecture": "aarch64","version": "6.1.0-32-cloud-arm64"},"platform": "CPython 3.9.21.final.0"}}, returnFieldsSelector: }'
173154
type: config
174155
requests:
175156
- header:
176-
length: 283
177-
requestId: 1804289383
157+
length: 269
158+
requestId: 846930886
178159
responseTo: 0
179160
Opcode: 2004
180161
message:
181162
flags: 0
182163
collection_name: admin.$cmd
183164
number_to_skip: 0
184165
number_to_return: -1
185-
query: '{"ismaster":{"$numberInt":"1"},"helloOk":true,"client":{"driver":{"name":"PyMongo","version":"4.6.3"},"os":{"type":"Linux","name":"Linux","architecture":"x86_64","version":"5.15.146.1-microsoft-standard-WSL2"},"platform":"CPython 3.10.12.final.0"}}'
166+
query: '{"ismaster":{"$numberInt":"1"},"helloOk":true,"client":{"driver":{"name":"PyMongo","version":"4.4.1"},"os":{"type":"Linux","name":"Linux","architecture":"aarch64","version":"6.1.0-32-cloud-arm64"},"platform":"CPython 3.9.21.final.0"}}'
186167
return_fields_selector: ""
187168
responses:
188169
- header:
189170
length: 329
190-
requestId: 238
191-
responseTo: 1804289383
171+
requestId: 3
172+
responseTo: 846930886
192173
Opcode: 1
193174
message:
194175
response_flags: 8
195176
cursor_id: 0
196177
starting_from: 0
197178
number_returned: 1
198179
documents:
199-
- '{"helloOk":true,"ismaster":true,"topologyVersion":{"processId":{"$oid":"6626352423399d438e00b0cf"},"counter":{"$numberLong":"0"}},"maxBsonObjectSize":{"$numberInt":"16777216"},"maxMessageSizeBytes":{"$numberInt":"48000000"},"maxWriteBatchSize":{"$numberInt":"100000"},"localTime":{"$date":{"$numberLong":"1713784113763"}},"logicalSessionTimeoutMinutes":{"$numberInt":"30"},"connectionId":{"$numberInt":"18"},"minWireVersion":{"$numberInt":"0"},"maxWireVersion":{"$numberInt":"21"},"readOnly":false,"ok":{"$numberDouble":"1.0"}}'
200-
read_delay: 1010011
201-
created: 1713784113
202-
reqTimestampMock: 2024-04-22T16:38:33.762559618+05:30
203-
resTimestampMock: 2024-04-22T16:38:33.763749062+05:30
180+
- '{"helloOk":true,"ismaster":true,"topologyVersion":{"processId":{"$oid":"67ed3773a2f7dd8385defa99"},"counter":{"$numberLong":"0"}},"maxBsonObjectSize":{"$numberInt":"16777216"},"maxMessageSizeBytes":{"$numberInt":"48000000"},"maxWriteBatchSize":{"$numberInt":"100000"},"localTime":{"$date":{"$numberLong":"1743599485435"}},"logicalSessionTimeoutMinutes":{"$numberInt":"30"},"connectionId":{"$numberInt":"1"},"minWireVersion":{"$numberInt":"0"},"maxWireVersion":{"$numberInt":"25"},"readOnly":false,"ok":{"$numberDouble":"1.0"}}'
181+
read_delay: 990489
182+
created: 1743599485
183+
reqTimestampMock: 2025-04-02T13:11:25.434864042Z
184+
resTimestampMock: 2025-04-02T13:11:25.436114528Z
204185
```
205186

206187
Want to see if everything works as expected?

0 commit comments

Comments
 (0)