Skip to content

Commit e583a41

Browse files
improving test suite
1 parent 12afe70 commit e583a41

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

tests/test_feedback.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ def test_json_string_input(self) -> None:
6666
mock_response.raise_for_status = Mock()
6767
mock_request.return_value = mock_response
6868

69-
json_string = json.dumps({
70-
"feedback": "Great tools!",
71-
"account_id": "acc_123456",
72-
"tool_names": ["test_tool"]
73-
})
69+
json_string = json.dumps(
70+
{"feedback": "Great tools!", "account_id": "acc_123456", "tool_names": ["test_tool"]}
71+
)
7472
result = tool.execute(json_string)
7573
assert result["message"] == "Success"
7674

@@ -90,11 +88,13 @@ def test_single_account_execution(self) -> None:
9088
mock_response.raise_for_status = Mock()
9189
mock_request.return_value = mock_response
9290

93-
result = tool.execute({
94-
"feedback": "Great tools!",
95-
"account_id": "acc_123456",
96-
"tool_names": ["data_export", "analytics"],
97-
})
91+
result = tool.execute(
92+
{
93+
"feedback": "Great tools!",
94+
"account_id": "acc_123456",
95+
"tool_names": ["data_export", "analytics"],
96+
}
97+
)
9898

9999
assert result == api_response
100100
mock_request.assert_called_once()
@@ -139,11 +139,13 @@ def test_api_error_handling(self) -> None:
139139
mock_request.return_value = mock_response
140140

141141
with pytest.raises(StackOneError):
142-
tool.execute({
143-
"feedback": "Great tools!",
144-
"account_id": "acc_123456",
145-
"tool_names": ["test_tool"],
146-
})
142+
tool.execute(
143+
{
144+
"feedback": "Great tools!",
145+
"account_id": "acc_123456",
146+
"tool_names": ["test_tool"],
147+
}
148+
)
147149

148150
def test_multiple_account_ids_execution(self) -> None:
149151
"""Test execution with multiple account IDs - both success and mixed scenarios."""
@@ -158,11 +160,13 @@ def test_multiple_account_ids_execution(self) -> None:
158160
mock_response.raise_for_status = Mock()
159161
mock_request.return_value = mock_response
160162

161-
result = tool.execute({
162-
"feedback": "Great tools!",
163-
"account_id": ["acc_123456", "acc_789012", "acc_345678"],
164-
"tool_names": ["test_tool"],
165-
})
163+
result = tool.execute(
164+
{
165+
"feedback": "Great tools!",
166+
"account_id": ["acc_123456", "acc_789012", "acc_345678"],
167+
"tool_names": ["test_tool"],
168+
}
169+
)
166170

167171
assert result["message"] == "Feedback sent to 3 account(s)"
168172
assert result["total_accounts"] == 3
@@ -191,11 +195,13 @@ def mock_request_side_effect(*args, **kwargs):
191195
with patch("requests.request") as mock_request:
192196
mock_request.side_effect = mock_request_side_effect
193197

194-
result = tool.execute({
195-
"feedback": "Great tools!",
196-
"account_id": ["acc_123456", "acc_unauthorized"],
197-
"tool_names": ["test_tool"],
198-
})
198+
result = tool.execute(
199+
{
200+
"feedback": "Great tools!",
201+
"account_id": ["acc_123456", "acc_unauthorized"],
202+
"tool_names": ["test_tool"],
203+
}
204+
)
199205

200206
assert result["total_accounts"] == 2
201207
assert result["successful"] == 1

0 commit comments

Comments
 (0)