Skip to content

Commit 1c6b901

Browse files
authored
Update README.md
1 parent 4fe58ca commit 1c6b901

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

README.md

+170
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,173 @@ To run the Flask application, follow these steps:
4040
export FLASK_ENV=development
4141
flask run --reload
4242
```
43+
### Run the tests
44+
45+
1. **Inside your virtual environment, execute the following command to run the tests**
46+
47+
```bash
48+
python flask_test.py
49+
```
50+
51+
## API Documentation
52+
53+
### Error handling
54+
55+
Invoking any of the following errors will return a JSON object in this format:
56+
57+
```JSON
58+
{
59+
"success": False,
60+
"error": 400,
61+
"message": "bad request"
62+
}
63+
```
64+
65+
The API will return these error types when the request fails:
66+
67+
- 400: Bad Request
68+
- 405: Method Not Allowed
69+
- 422: Not Processable
70+
- 404: Resource Not Found
71+
72+
### Endpoints
73+
74+
**GET /tests**
75+
76+
- Sample
77+
78+
```JSON
79+
{
80+
"success": true,
81+
"test_cases": [
82+
{
83+
"description": "First Test Description",
84+
"id": 1,
85+
"name": "Updated Test Case"
86+
},
87+
{
88+
"description": null,
89+
"id": 2,
90+
"name": "Second Test"
91+
}
92+
],
93+
"total_test_cases": 5
94+
}
95+
```
96+
97+
**POST /tests**
98+
99+
- Sample
100+
101+
```JSON
102+
{
103+
"success": true,
104+
"test_case": {
105+
"description": "Fifth Test Case Description",
106+
"id": 6,
107+
"name": "Fifth Test Case"
108+
},
109+
"total_test_cases": 6
110+
}
111+
```
112+
113+
**GET /tests/{test.id}**
114+
115+
- Sample
116+
117+
```JSON
118+
{
119+
"success": true,
120+
"test_case": {
121+
"description": "Fifth Test Case Description",
122+
"id": 6,
123+
"name": "Fifth Test Case"
124+
}
125+
}
126+
```
127+
128+
**PATCH /tests/{test.id}**
129+
130+
- Sample
131+
132+
```JSON
133+
{
134+
"success": true,
135+
"test_case": {
136+
"description": "Sixth Test Case Description",
137+
"id": 6,
138+
"name": "Sixth Test Case"
139+
},
140+
"total_test_cases": 6
141+
}
142+
```
143+
144+
**DELETE /tests**
145+
146+
- Sample
147+
148+
```JSON
149+
{
150+
"deleted_test_case_id": 6,
151+
"success": true,
152+
"total_test_cases": 5
153+
}
154+
```
155+
156+
**GET /executions**
157+
158+
- Sample
159+
160+
```JSON
161+
{
162+
"asset": {
163+
"id": 2,
164+
"name": "Second Asset"
165+
},
166+
"executions": [
167+
{
168+
"details": "Success",
169+
"execution_date": "Sat, 02 Mar 2024 17:35:30 GMT",
170+
"id": 4,
171+
"status": true,
172+
"test_case": {
173+
"id": 1,
174+
"name": "Updated Test Case"
175+
}
176+
},
177+
{
178+
"details": "Success",
179+
"execution_date": "Sun, 03 Mar 2024 18:35:30 GMT",
180+
"id": 5,
181+
"status": true,
182+
"test_case": {
183+
"id": 3,
184+
"name": "Third Test"
185+
}
186+
}
187+
],
188+
"success": true,
189+
"total_executions": 2
190+
}
191+
```
192+
193+
**POST /executions**
194+
195+
- Sample
196+
197+
```JSON
198+
{
199+
"execution": {
200+
"asset_id": 1,
201+
"details": "Sucess",
202+
"id": 10,
203+
"status": true,
204+
"test_case_id": 1,
205+
"timestamp": "2024-02-29 09:36:57"
206+
},
207+
"success": true,
208+
"total_executions": 10
209+
}
210+
```
211+
212+

0 commit comments

Comments
 (0)