Skip to content

Commit 6af1f9b

Browse files
committed
fix: fix the case that include_failed cannot be set to False.
1 parent 0ea1090 commit 6af1f9b

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

stellar_sdk/call_builder/base_call_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ def _add_query_param(self, key: str, value: Union[str, float, int, bool, None]):
126126
pass
127127
elif value is True:
128128
self.params[key] = "true"
129+
elif value is False:
130+
self.params[key] = "false"
129131
else:
130132
self.params[key] = str(value)
131133

tests/call_builder/test_operations_call_builder.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,15 @@ def test_include_failed(self):
5353
account_id=account_id
5454
)
5555
assert builder.params == {"include_failed": "true"}
56+
57+
def test_not_include_failed(self):
58+
account_id = "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH"
59+
builder = (
60+
OperationsCallBuilder(horizon_url, client)
61+
.for_account(account_id)
62+
.include_failed(False)
63+
)
64+
assert builder.endpoint == "accounts/{account_id}/operations".format(
65+
account_id=account_id
66+
)
67+
assert builder.params == {"include_failed": "false"}

tests/call_builder/test_payments_call_builder.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ def test_include_failed(self):
4646
account_id=account_id
4747
)
4848
assert builder.params == {"include_failed": "true"}
49+
50+
def test_not_include_failed(self):
51+
account_id = "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH"
52+
builder = (
53+
PaymentsCallBuilder(horizon_url, client)
54+
.for_account(account_id)
55+
.include_failed(False)
56+
)
57+
assert builder.endpoint == "accounts/{account_id}/payments".format(
58+
account_id=account_id
59+
)
60+
assert builder.params == {"include_failed": "false"}

tests/call_builder/test_transactions_call_builder.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,15 @@ def test_include_failed(self):
4545
account_id=account_id
4646
)
4747
assert builder.params == {"include_failed": "true"}
48+
49+
def test_not_include_failed(self):
50+
account_id = "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH"
51+
builder = (
52+
TransactionsCallBuilder(horizon_url, client)
53+
.for_account(account_id)
54+
.include_failed(False)
55+
)
56+
assert builder.endpoint == "accounts/{account_id}/transactions".format(
57+
account_id=account_id
58+
)
59+
assert builder.params == {"include_failed": "false"}

0 commit comments

Comments
 (0)