-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
crm.company.contact.items.get возвращает только один элемент, а нужно несколько #257
Conversation
Руководство для проверяющего от SourceryЭтот PR исправляет проблему, когда эндпоинт crm.company.contact.items.get возвращал только один элемент вместо нескольких. Изменения обновляют логику извлечения ответа, улучшают форматирование тестов и добавляют новый тест с соответствующим файлом фикстуры ответа для проверки возврата нескольких элементов. Диаграммы не сгенерированы, так как изменения выглядят простыми и не требуют визуального представления. Изменения на уровне файлов
Оценка по связанным задачам
Возможно, связанные задачи
Советы и командыВзаимодействие с Sourcery
Настройка вашего опытаПерейдите на свою панель управления, чтобы:
Получение помощи
Original review guide in EnglishReviewer's Guide by SourceryThis PR fixes the issue where the crm.company.contact.items.get endpoint was returning only a single element instead of multiple. The changes update the response extraction logic, improve test formatting, and add a new test with a corresponding response fixture to verify multiple items are returned. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leshchenko1979 - I've reviewed your changes - here's some feedback:
Overall Comments:
- The
is_nested
function should check if the input is a dictionary with exactly one key, not just one value. - Consider adding a more descriptive name to
crm_company_contact_items_get.py
to clarify its purpose.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
assert results[0]["NAME"] == "Абдуалимова Татьяна Александровна" | ||
|
||
|
||
def test_crm_company_contact_items_get(bx_dummy): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (testing): Suggest adding more assertions to cover different aspects of the response.
It would be beneficial to assert the content of the returned list, such as checking the 'CONTACT_ID', 'SORT', 'ROLE_ID', and 'IS_PRIMARY' fields for each item. This ensures that the function not only returns the correct number of elements but also that the elements contain the expected data.
Suggested implementation:
def test_crm_company_contact_items_get(bx_dummy):
from tests.real_responses.crm_company_contact_items_get import response
assert isinstance(response, list)
# Change the expected count if needed
assert len(response) == 1
contact_item = response[0]
# These expected values should be updated to reflect the actual expected data
assert contact_item["CONTACT_ID"] == "expected_contact_id"
assert contact_item["SORT"] == "expected_sort"
assert contact_item["ROLE_ID"] == "expected_role_id"
assert contact_item["IS_PRIMARY"] == True
Ensure that the expected values (e.g., "expected_contact_id", "expected_sort", "expected_role_id") match the actual response data for the test. If the true expected values are known, replace these placeholder strings accordingly.
|
||
|
||
def test_crm_company_contact_items_get(bx_dummy): | ||
from tests.real_responses.crm_company_contact_items_get import response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (code-quality): Don't import test modules. (dont-import-test-modules
)
Explanation
Don't import test modules.Tests should be self-contained and don't depend on each other.
If a helper function is used by multiple tests,
define it in a helper module,
instead of importing one test from the other.
Fixes #256
Обзор от Sourcery
Исправления ошибок:
crm.company.contact.items.get
возвращал только один элемент, хотя ожидалось несколько.Original summary in English
Summary by Sourcery
Bug Fixes:
crm.company.contact.items.get
was returning only one item when multiple items were expected.