Skip to content

Commit

Permalink
MAINT: update calls to sort
Browse files Browse the repository at this point in the history
update to use new function signature
  • Loading branch information
anish-mudaraddi committed Jun 27, 2024
1 parent 041691f commit 671b76b
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/workflows/list_all_openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def list_all_openstack(
query.select(properties_to_select)

if sort_by:
query.sort_by(*[(p, SortOrder.DESC) for p in sort_by])
query.sort_by([(p, SortOrder.DESC) for p in sort_by])
if group_by:
query.group_by(group_by)

Expand Down
2 changes: 1 addition & 1 deletion lib/workflows/search_by_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def search_by_datetime(
},
)
if sort_by:
query.sort_by(*[(p, SortOrder.DESC) for p in sort_by])
query.sort_by([(p, SortOrder.DESC) for p in sort_by])
if group_by:
query.group_by(group_by)

Expand Down
2 changes: 1 addition & 1 deletion lib/workflows/search_by_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def search_by_property(
)

if sort_by:
query.sort_by(*[(p, SortOrder.DESC) for p in sort_by])
query.sort_by([(p, SortOrder.DESC) for p in sort_by])
if group_by:
query.group_by(group_by)

Expand Down
2 changes: 1 addition & 1 deletion lib/workflows/search_by_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def search_by_regex(
)

if sort_by:
query.sort_by(*[(p, SortOrder.DESC) for p in sort_by])
query.sort_by([(p, SortOrder.DESC) for p in sort_by])
if group_by:
query.group_by(group_by)

Expand Down
2 changes: 1 addition & 1 deletion lib/workflows/send_decom_flavor_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def find_servers_with_decom_flavors(
values=flavor_name_list,
)
flavor_query.run(cloud_account)
flavor_query.sort_by((FlavorProperties.FLAVOR_ID, SortOrder.ASC))
flavor_query.sort_by([(FlavorProperties.FLAVOR_ID, SortOrder.ASC)])

if not flavor_query.to_props():
raise RuntimeError(
Expand Down
2 changes: 1 addition & 1 deletion lib/workflows/send_decom_image_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def find_servers_with_decom_images(
from_projects=from_projects if from_projects else None,
all_projects=not from_projects,
)
image_query.sort_by(("id", "ascending"), ("name", "ascending"))
image_query.sort_by([("id", "ascending"), ("name", "ascending")])
image_query.select(["name"])

if not image_query.to_props():
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/workflows/test_list_all_openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_list_all_openstack_all(mock_openstack_query, output_type):

mock_query.select.assert_called_once_with(params["properties_to_select"])
mock_query.sort_by.assert_called_once_with(
*[(p, SortOrder.DESC) for p in params["sort_by"]]
[(p, SortOrder.DESC) for p in params["sort_by"]]
)
mock_query.group_by.assert_called_once_with(params["group_by"])
mock_query.run.assert_called_once_with(
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/workflows/test_search_by_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_search_by_datetime_all(mock_preset_enum, mock_openstack_query, output_t
},
)
mock_query.sort_by.assert_called_once_with(
*[(p, SortOrder.DESC) for p in params["sort_by"]]
[(p, SortOrder.DESC) for p in params["sort_by"]]
)
mock_query.group_by.assert_called_once_with(params["group_by"])
mock_query.run.assert_called_once_with(
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/workflows/test_search_by_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_search_by_property_all(mock_preset_enum, mock_openstack_query, output_t
args={"values": params["values"]},
)
mock_query.sort_by.assert_called_once_with(
*[(p, SortOrder.DESC) for p in params["sort_by"]]
[(p, SortOrder.DESC) for p in params["sort_by"]]
)
mock_query.group_by.assert_called_once_with(params["group_by"])
mock_query.run.assert_called_once_with(
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/workflows/test_search_by_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_search_by_regex_all(mock_openstack_query, output_type):
args={"value": params["pattern"]},
)
mock_query.sort_by.assert_called_once_with(
*[(p, SortOrder.DESC) for p in params["sort_by"]]
[(p, SortOrder.DESC) for p in params["sort_by"]]
)
mock_query.group_by.assert_called_once_with(params["group_by"])
mock_query.run.assert_called_once_with(
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/workflows/test_send_decom_flavor_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_find_users_with_decom_flavor_valid(mock_flavor_query):
)
mock_flavor_query_obj.run.assert_called_once_with("test-cloud-account")
mock_flavor_query_obj.sort_by.assert_called_once_with(
(FlavorProperties.FLAVOR_ID, SortOrder.ASC)
[(FlavorProperties.FLAVOR_ID, SortOrder.ASC)]
)
mock_flavor_query_obj.to_props.assert_called_once()

Expand Down Expand Up @@ -231,7 +231,7 @@ def test_find_users_with_decom_flavor_invalid_flavor(mock_flavor_query):
)
mock_flavor_query_obj.run.assert_called_once_with("test-cloud-account")
mock_flavor_query_obj.sort_by.assert_called_once_with(
(FlavorProperties.FLAVOR_ID, SortOrder.ASC)
[(FlavorProperties.FLAVOR_ID, SortOrder.ASC)]
)
mock_flavor_query_obj.to_props.assert_called_once()

Expand All @@ -258,7 +258,7 @@ def test_find_users_with_decom_flavor_no_servers_found(mock_flavor_query):
)
mock_flavor_query_obj.run.assert_called_once_with("test-cloud-account")
mock_flavor_query_obj.sort_by.assert_called_once_with(
(FlavorProperties.FLAVOR_ID, SortOrder.ASC)
[(FlavorProperties.FLAVOR_ID, SortOrder.ASC)]
)
mock_flavor_query_obj.to_props.assert_called_once()

Expand Down
6 changes: 3 additions & 3 deletions tests/lib/workflows/test_send_decom_image_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_find_servers_with_decom_images_valid(mock_list_to_regex, mock_image_que
all_projects=False,
)
mock_image_query_obj.sort_by.assert_called_once_with(
("id", "ascending"), ("name", "ascending")
[("id", "ascending"), ("name", "ascending")]
)
mock_image_query_obj.to_props.assert_called_once()
mock_image_query_obj.then.assert_called_once_with(
Expand Down Expand Up @@ -262,7 +262,7 @@ def test_find_servers_with_decom_images_invalid_images(
all_projects=True,
)
mock_image_query_obj.sort_by.assert_called_once_with(
("id", "ascending"), ("name", "ascending")
[("id", "ascending"), ("name", "ascending")]
)
mock_image_query_obj.to_props.assert_called_once()

Expand Down Expand Up @@ -300,7 +300,7 @@ def test_find_servers_with_decom_images_no_servers_found(
all_projects=False,
)
mock_image_query_obj.sort_by.assert_called_once_with(
("id", "ascending"), ("name", "ascending")
[("id", "ascending"), ("name", "ascending")]
)
mock_image_query_obj.to_props.assert_called_once()

Expand Down

0 comments on commit 671b76b

Please sign in to comment.