Skip to content

Commit

Permalink
Added a test for the webhook.
Browse files Browse the repository at this point in the history
  • Loading branch information
lizsalmon committed Dec 20, 2024
1 parent 095ae5a commit 705b248
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 109 deletions.
109 changes: 0 additions & 109 deletions tests/lib/workflows/test_migrate_server.py

This file was deleted.

31 changes: 31 additions & 0 deletions tests/lib/workflows/test_search_by_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,34 @@ def test_search_by_property_all(mock_openstackquery, mock_to_webhook, output_typ
"to_props": mock_query.to_props.return_value,
}[output_type]
)


@patch("workflows.search_by_property.to_webhook")
def test_search_by_property_migrate_webhook(mock_openstackquery):
"""
Runs search_by_property with webhook as migrate-server
"""

mock_query = MagicMock()
mock_cloud_account = NonCallableMock()

mock_openstackquery.MockQuery.return_value = mock_query
params = {
"cloud_account": mock_cloud_account,
"query_type": "MockQuery",
"search_mode": NonCallableMock(),
"property_to_search_by": NonCallableMock(),
"output_type": "test",
"properties_to_select": ["prop1", "prop2"],
"values": ["val1", "val2"],
"group_by": NonCallableMock(),
"sort_by": ["prop1", "prop2"],
"webhook": "migrate-server",
"arg1": "val1",
"arg2": "val2",
}
search_by_property(**params)

mock_query.select.assert_called_once_with(
*params["properties_to_select"], "server_id", "server_status"
)

0 comments on commit 705b248

Please sign in to comment.