Skip to content

Commit

Permalink
fix: correct transform of logical parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
danfimov committed Oct 7, 2023
1 parent 37e9f7a commit 24b0831
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 37 deletions.
57 changes: 32 additions & 25 deletions examples/get_test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@ async def main() -> None:
oauth_token=API_TOKEN,
)

# requests for tests
me = await client.get_myself()
await client.get_user(uid=me.uid)
await client.get_users()
await client.get_issue('TRACKER-1')
await client.get_issue('TRACKER-1', expand='transitions')
await client.get_issue('TRACKER-1', expand='attachments')
await client.get_issue_transitions('TRACKER-1')
await client.get_queue('TRACKER')
await client.get_queue_fields('TRACKER')
await client.get_queue_versions('TRACKER')
await client.get_issue_relationships('TRACKER-1')
await client.get_checklist_items("TRACKER-1")
await client.get_components()
await client.get_worklog("TRACKER-1")
await client.get_worklog_records_by_parameters(me.login)
await client.get_attachments_list('TRACKER-1')
await client.get_issue_comments('TRACKER-1')
await client.get_projects_list(expand='queues')
await client.get_external_applications()
await client.get_external_links("TRACKER-1")
await client.get_macros('TRACKER')
await client.find_number_of_issues(issue_filter={'queue': 'TRACKER', "assignee": "empty()"})
await client.get_history_issue_changes('TRACKER-1')
await client.find_issues()

try:
# requests for tests
me = await client.get_myself()
await client.get_user(uid=me.uid)
await client.get_users()
await client.get_issue('TRACKER-1')
await client.get_issue('TRACKER-1', expand='transitions')
await client.get_issue('TRACKER-1', expand='attachments')
await client.get_issue_transitions('TRACKER-1')
await client.get_queue('TRACKER')
await client.get_queue_fields('TRACKER')
await client.get_queue_versions('TRACKER')
await client.get_issue_relationships('TRACKER-1')
await client.get_checklist_items("TRACKER-1")
await client.get_components()
await client.get_worklog("TRACKER-1")
await client.get_worklog_records_by_parameters(me.login)
await client.get_attachments_list('TRACKER-1')
await client.get_issue_comments('TRACKER-1')
await client.get_projects_list(expand='queues')
await client.get_external_applications()
await client.get_external_links("TRACKER-1")
await client.get_macros('TRACKER')
await client.find_number_of_issues(issue_filter={'queue': 'TRACKER', "assignee": "empty()"})
await client.get_history_issue_changes('TRACKER-1')
await client.find_issues()
except Exception as e:
print('Test failed')
print(e)
else:
print('Test passed')

await client.stop()

Expand Down
6 changes: 3 additions & 3 deletions ya_tracker_client/domain/repositories/bulk_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def bulk_move_issues(
move_all_fields=move_all_fields,
initial_status=initial_status,
).model_dump(exclude_none=True, by_alias=True),
params={"notify": "true" if notify else "false"},
params={"notify": str(notify).lower()},
)
return self._decode(raw_response, BulkOperation)

Expand All @@ -45,7 +45,7 @@ async def bulk_change_issues(
issues=issue_ids,
values=values,
).model_dump(exclude_none=True, by_alias=True),
params={"notify": "true" if notify else "false"},
params={"notify": str(notify).lower()},
)
return self._decode(raw_response, BulkOperation)

Expand All @@ -67,6 +67,6 @@ async def bulk_change_issues_statuses(
issues=issue_ids,
values=values,
).model_dump(exclude_none=True, by_alias=True),
params={"notify": "true" if notify else "false"},
params={"notify": str(notify).lower()},
)
return self._decode(raw_response, BulkOperation)
4 changes: 2 additions & 2 deletions ya_tracker_client/domain/repositories/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async def add_comment(
attachment_ids: list[str] | None = None,
summonees: list[str | UserShort] | None = None,
maillist_summonees: list[str] | None = None,
is_add_to_followers: bool | None = None,
is_add_to_followers: bool = True,
) -> Comment:
"""
Use this method to add a comment to an issue.
Expand All @@ -27,7 +27,7 @@ async def add_comment(
summonees=summonees,
maillist_summonees=maillist_summonees,
).model_dump(exclude_none=True, by_alias=True),
params={"is_add_to_followers": is_add_to_followers} if is_add_to_followers is not None else None,
params={"is_add_to_followers": str(is_add_to_followers).lower()}
)
return self._decode(raw_response, Comment)

Expand Down
4 changes: 2 additions & 2 deletions ya_tracker_client/domain/repositories/external_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def add_external_link(
key: str,
origin: str,
relationship: str = "RELATES",
backlink: bool | None = None,
backlink: bool = False,
) -> ExternalLink:
"""
YC docs: https://cloud.yandex.com/en/docs/tracker/concepts/issues/add-external-link
Expand All @@ -43,7 +43,7 @@ async def add_external_link(
"origin": origin,
"relationship": relationship,
},
params={"backlink": backlink} if backlink is not None else None,
params={"backlink": str(backlink).lower()},
)
return self._decode(raw_response, ExternalLink)

Expand Down
10 changes: 5 additions & 5 deletions ya_tracker_client/domain/repositories/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def get_priorities(
raw_response = await self._client.request(
method="GET",
uri="/priorities/",
params={"localized": str(localized)},
params={"localized": str(localized).lower()},
)
return self._decode(raw_response, Priority)

Expand Down Expand Up @@ -147,10 +147,10 @@ async def move_issue_to_another_queue(
uri=f"/issues/{issue_id}/_move",
params={
"queue": queue_id,
"notify": str(notify),
"notifyAuthor": str(notify_author),
"moveAllFields": str(move_all_fields),
"initialStatus": str(initial_status),
"notify": str(notify).lower(),
"notifyAuthor": str(notify_author).lower(),
"moveAllFields": str(move_all_fields).lower(),
"initialStatus": str(initial_status).lower(),
"expand": expand or "",
},
payload=IssueEdit(**kwargs).model_dump(exclude_unset=True),
Expand Down

0 comments on commit 24b0831

Please sign in to comment.