You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -243,6 +244,36 @@ By default, Turbo includes Swagger for API schema which is available here `http:
243
244
244
245
At the moment, Turbo does not contain any examples of client side requests towards the backend. All the requests are handled by server actions. For client side requests, it is recommended to use [react-query](https://github.com/TanStack/query).
245
246
247
+
## Test suite
248
+
249
+
Project contains test suite for backend part. For testing it was used library called [pytest](https://docs.pytest.org/en/latest/) along with some additinal libraries extending functionality of pytest:
250
+
251
+
- [pytest-django](https://pytest-django.readthedocs.io/en/latest/) - for testing django applications
252
+
- [pytest-factoryboy](https://pytest-factoryboy.readthedocs.io/en/latest/) - for creating test data
253
+
254
+
All these libraries mentioned above are already preconfigured in `backend/api/tests` directory.
255
+
256
+
- `conftest.py`- for configuring pytest
257
+
- `factories.py`- for generating reusable test objects using factory_boy, which creates model instances with default values that can be customized as needed
258
+
- `fixtures.py`- for creating pytest fixtures that provide test data or resources that can be shared and reused across multiple tests
259
+
260
+
To run tests, use the command below which will collect all the tests available in backend/api/tests folder:
261
+
262
+
```bash
263
+
docker compose exec api uv run -- pytest .
264
+
```
265
+
266
+
Tu run tests available only in one specific file run:
267
+
268
+
```bash
269
+
docker compose exec api uv run -- pytest api/tests/test_api.py
270
+
```
271
+
272
+
To run one specific test, use the command below:
273
+
274
+
```bash
275
+
docker compose exec api uv run -- pytest api/tests/test_api.py -k "test_api_users_me_authorized"
0 commit comments