Skip to content

Commit a76fc1a

Browse files
author
Ramin Esfandiari
committed
Add a test for calling validate currency non statically
1 parent 351121f commit a76fc1a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_decorators.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,18 @@ def handler(event, a=None): # noqa: pylint - unused-argument
17221722
self.assertEqual("{\"message\": [{\"a\": [\"\'GBT\' is not a valid currency code.\"]}]}",
17231723
response["body"])
17241724

1725+
def test_currency_validator_can_be_called_non_statically(self):
1726+
event = {
1727+
"a": "GBP"
1728+
}
1729+
1730+
@extract([Parameter("/a", "event", [CurrencyValidator()])])
1731+
def handler(event, a=None): # noqa: pylint - unused-argument
1732+
return a
1733+
1734+
response = handler(event)
1735+
self.assertEqual("GBP", response)
1736+
17251737
def test_can_apply_transformation(self):
17261738
event = {
17271739
"a": "2"

0 commit comments

Comments
 (0)