-
Notifications
You must be signed in to change notification settings - Fork 47
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
[TECH-debt] Tasking::get_quotations
test coverage fix
#684
base: master
Are you sure you want to change the base?
Conversation
up42/tasking.py
Outdated
session = base.Session() | ||
workspace_id = base.WorkspaceId() |
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.
Not needed, comes from the parent
up42/tasking.py
Outdated
"workspaceId": workspace_id, | ||
"id": quotation_id, | ||
"orderId": order_id, | ||
"decision": set(decision) if decision else None, |
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.
"decision": decision
up42/tasking.py
Outdated
"id": quotation_id, | ||
"orderId": order_id, | ||
"decision": set(decision) if decision else None, | ||
"sort": sortby + sort_order, |
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.
"sort": utils.SortingField(sortby, descending)
up42/tasking.py
Outdated
} | ||
quotations = [] | ||
current_page = 0 | ||
while True: |
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.
Let's reuse the approach from Order module
up42/tasking.py
Outdated
return self._query_paginated_output(url) | ||
sort_order = ",desc" if descending else ",asc" | ||
query_params = { | ||
key: str(value) |
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.
Why do we need str here?
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.
No, actually it was an error as desicion is an array.
tests/test_tasking.py
Outdated
sortby=sort_by, | ||
descending=descending, | ||
) | ||
assert len(get_quotations) == 10 * total_pages |
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.
We need to check its content
tests/test_tasking.py
Outdated
query = urllib.parse.urlencode(query_params) | ||
url += query and f"?{query}" | ||
response = { | ||
"content": [{"id": str(uuid.uuid4())} for _ in range(10)], |
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.
Let's switch to "id": f"id{idx}" to be able to check the content
tests/test_tasking.py
Outdated
): | ||
total_pages = 4 | ||
query_params: dict[str, Any] = {} | ||
sort_order = ",desc" if descending else ",asc" |
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.
let's add this to parameterization
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.
I have parametrized descending
parameter and set the value according to it. Is that what you meant?
tests/test_tasking.py
Outdated
if order_id: | ||
query_params["orderId"] = order_id | ||
if decision: | ||
query_params["decision"] = set(decision) |
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.
set is not needed
tests/test_tasking.py
Outdated
@pytest.mark.parametrize("workspace_id", [None, constants.WORKSPACE_ID]) | ||
@pytest.mark.parametrize("order_id", [None, ORDER_ID]) | ||
@pytest.mark.parametrize("decision", [None, ["NOT_DECIDED", "ACCEPTED", "REJECTED"]]) | ||
@pytest.mark.parametrize("sort_by", ["updatedAt"]) |
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.
there's no point in parameterizing this
Quality Gate passedIssues Measures |
See changelog.
Checklist: