Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dev add document download view #71

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

dev-lymar
Copy link
Owner

No description provided.

@dev-lymar dev-lymar requested a review from leeroymk June 19, 2024 08:43
Copy link
Collaborator

@leeroymk leeroymk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в целом ок, ничего критичного

makedoc/tests/test_views_makedoc.py Outdated Show resolved Hide resolved
makedoc/tests/test_views_makedoc.py Outdated Show resolved Hide resolved
makedoc/tests/test_views_makedoc.py Outdated Show resolved Hide resolved
makedoc/tests/test_views_makedoc.py Outdated Show resolved Hide resolved
Repository owner deleted a comment from leeroymk Jun 19, 2024
Repository owner deleted a comment from leeroymk Jun 19, 2024
Copy link
Collaborator

@leeroymk leeroymk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В целом ок.

Есть что поправить.

По цифрам на твое усмотрение.

from rest_framework.test import APIClient
from rest_framework_simplejwt.tokens import RefreshToken

from users.models import CustomUser

fake = Faker()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Создавать его нет необходимости, можно использовать имеющуюся фикстуру faker



@pytest.fixture
def test_data():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фикстура-фабрика должна начинаться с make_, желательно переименовать

@pytest.fixture
def test_data():
return {
"delivery_type": fake.random_element(elements=("auto", "manual")),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Значения которые мы передаем - ("auto", "rw", "self-deliery")

"client_id": fake.random_int(min=1, max=100),
"items": [
{"product_id": fake.random_int(min=1, max=100),
"quantity": fake.random_int(min=1, max=10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Количество у нас в тоннах, это FloatField также в сериализаторе.

10 - слишком мало, здесь можно и 1000 поставить.

"items": [
{"product_id": fake.random_int(min=1, max=100),
"quantity": fake.random_int(min=1, max=10),
"discount": fake.random_int(min=0, max=50)},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

До 100 можно в тестах проверять. Может быть даже разнести на несколько кейсов, с 0, 100 и всеми остальными вариантами.

"quantity": fake.random_int(min=1, max=10),
"discount": fake.random_int(min=0, max=50)},
],
"factory_id": fake.random_int(min=1, max=100),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Фабрик пока у нас 3, 100 слишком много.

"discount": fake.random_int(min=0, max=50)},
],
"factory_id": fake.random_int(min=1, max=100),
"destination": fake.city(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в destination мы получаем либо "0", либо две склеенных через запятую строки (можно и 2 pystr).

Наверное здесь лучше разнести тесты на 2 кейса.

],
"factory_id": fake.random_int(min=1, max=100),
"destination": fake.city(),
"delivery_cost": fake.random_int(min=100, max=2000),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В сериализаторе у нас минимальная стоимость рейса 0, максимальная на практике (пока) доходит до 15000.

Тоже наверное лучше на разные кейсы разнести: 0, все остальное.

@dev-lymar dev-lymar merged commit 9df925a into main Jun 21, 2024
5 checks passed
@dev-lymar dev-lymar deleted the feat/dev-add-document-download-view branch June 21, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants