Conversation
…ле теста и написал тесты на создание пользователя
…писал функцию, которая возвращает список хэшей ингридиентов
irisqul
reviewed
Sep 10, 2026
irisqul
left a comment
There was a problem hiding this comment.
✅ Сильные стороны:
- Код запускается без ошибок
- Проверяется тело и код отчета, там где это необходимо
- Тестовые данные создаются перед тестом и удаляются после того, как он выполнится
- Тестовая архитектура соответствует изученным практикам написания автотестов
| from url import URL | ||
| import allure | ||
|
|
||
| class OrderMethods: |
There was a problem hiding this comment.
Отлично: создан интерфейс для взаимодействия с АПИ, код стал более управляемым
| def test_create_order_with_authorization_succeed(self, random_user_data): | ||
|
|
||
| user_data = random_user_data | ||
| UserMethods.create_user(user_data) |
There was a problem hiding this comment.
можно лучше: наличие зарегистрированного курьера в данном тесте предусловие, т.е. лучше перенести в фикстуру
| user_data = random_user_data | ||
|
|
||
| response_create = UserMethods.create_user(user_data) | ||
| assert response_create.status_code == 200, "Не удалось создать пользователя" |
There was a problem hiding this comment.
Нужно исправить: тест неатомарный. после ассерта уже не должно быть шагов, а каждый тест должен проверять какое то одно поведение приложения
| user_data = random_user_data.copy() | ||
|
|
||
| response_create = UserMethods.create_user(user_data) | ||
| assert response_create.status_code == 200, "Не удалось создать пользователя" |
| user_data = random_user_data.copy() | ||
|
|
||
| response_create = UserMethods.create_user(user_data) | ||
| assert response_create.status_code == 200, "Не удалось создать пользователя" |
| def get_list_of_ingredients(): | ||
|
|
||
| response = IngredientsMethods.get_ingredients() | ||
| assert response.status_code == 200, "Не удалось получить ингредиенты" |
There was a problem hiding this comment.
не нужно прятать ассерт в методы, это сделает тесты неатомарными
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Написал тесты на API для [Stellar Burgers]
Подключил библиотеки: pytest, requests и allure-pytest.
Сделай отчёт в Allure.