-
-
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
response = { | ||
"result": { | ||
"result": { | ||
"205364": [ | ||
{"CONTACT_ID": 350354, "SORT": 10, "ROLE_ID": 0, "IS_PRIMARY": "Y"}, | ||
{"CONTACT_ID": 369658, "SORT": 10, "ROLE_ID": 0, "IS_PRIMARY": "Y"}, | ||
] | ||
}, | ||
"result_error": [], | ||
"result_total": [], | ||
"result_next": [], | ||
"result_time": { | ||
"205364": { | ||
"start": 1739205151.785116, | ||
"finish": 1739205151.915156, | ||
"duration": 0.13003993034362793, | ||
"processing": 0.12938594818115234, | ||
"date_start": "2025-02-10T19:32:31+03:00", | ||
"date_finish": "2025-02-10T19:32:31+03:00", | ||
"operating_reset_at": 1739205751, | ||
"operating": 0.7021360397338867, | ||
} | ||
}, | ||
}, | ||
"time": { | ||
"start": 1739205151.753569, | ||
"finish": 1739205151.916085, | ||
"duration": 0.16251611709594727, | ||
"processing": 0.13108110427856445, | ||
"date_start": "2025-02-10T19:32:31+03:00", | ||
"date_finish": "2025-02-10T19:32:31+03:00", | ||
"operating_reset_at": 1739205751, | ||
"operating": 0, | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,12 +311,10 @@ def test_crm_contact_add_batch(bx_dummy): | |
"NAME": "TESTR", | ||
"PHONE": [{"VALUE": "78966666647", "VALUE_TYPE": "WORK"}], | ||
"ASSIGNED_BY_ID": -1, | ||
"OPENED": "Y" | ||
"OPENED": "Y", | ||
}, | ||
"params": { | ||
"REGISTER_SONET_EVENT": "Y" | ||
} | ||
} | ||
"params": {"REGISTER_SONET_EVENT": "Y"}, | ||
}, | ||
) | ||
|
||
# Проверяем что результат - это ID созданного контакта | ||
|
@@ -325,39 +323,47 @@ def test_crm_contact_add_batch(bx_dummy): | |
|
||
def test_crm_contact_list(bx_dummy): | ||
response = { | ||
'result': [ | ||
"result": [ | ||
{ | ||
'ID': '10', | ||
'NAME': 'Абдуалимова Татьяна Александровна', | ||
'SECOND_NAME': None, | ||
'LAST_NAME': None | ||
"ID": "10", | ||
"NAME": "Абдуалимова Татьяна Александровна", | ||
"SECOND_NAME": None, | ||
"LAST_NAME": None, | ||
} | ||
], | ||
'total': 1, | ||
'time': { | ||
'start': 1731743829.0188, | ||
'finish': 1731743829.06444, | ||
'duration': 0.045639991760253906, | ||
'processing': 0.019975900650024414, | ||
'date_start': '2024-11-16T10:57:09+03:00', | ||
'date_finish': '2024-11-16T10:57:09+03:00', | ||
'operating_reset_at': 1731744429, | ||
'operating': 0 | ||
} | ||
"total": 1, | ||
"time": { | ||
"start": 1731743829.0188, | ||
"finish": 1731743829.06444, | ||
"duration": 0.045639991760253906, | ||
"processing": 0.019975900650024414, | ||
"date_start": "2024-11-16T10:57:09+03:00", | ||
"date_finish": "2024-11-16T10:57:09+03:00", | ||
"operating_reset_at": 1731744429, | ||
"operating": 0, | ||
}, | ||
} | ||
|
||
bx_dummy.srh = MockSRH(response) | ||
results = bx_dummy.get_all( | ||
'crm.contact.list', | ||
"crm.contact.list", | ||
{ | ||
'params': { | ||
'select': ['ID', 'NAME', 'SECOND_NAME', 'LAST_NAME'], | ||
'filter': {'=ID': ['10']} | ||
"params": { | ||
"select": ["ID", "NAME", "SECOND_NAME", "LAST_NAME"], | ||
"filter": {"=ID": ["10"]}, | ||
} | ||
} | ||
}, | ||
) | ||
|
||
assert isinstance(results, list) | ||
assert len(results) == 1 | ||
assert results[0]['ID'] == '10' | ||
assert results[0]['NAME'] == 'Абдуалимова Татьяна Александровна' | ||
assert results[0]["ID"] == "10" | ||
assert results[0]["NAME"] == "Абдуалимова Татьяна Александровна" | ||
|
||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. issue (code-quality): Don't import test modules. ( ExplanationDon'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, |
||
|
||
bx_dummy.srh = MockSRH(response) | ||
results = bx_dummy.get_by_ID("crm.company.contact.items.get", ["205364"]) | ||
assert len(results) == 2 |
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.
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:
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.